Class: Brutal::Manifest::File

Inherits:
Object
  • Object
show all
Defined in:
lib/brutal/manifest/file.rb,
lib/brutal/manifest/file/name.rb

Overview

YAML manifest file parser.

Defined Under Namespace

Modules: Name

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pathname) ⇒ File

Returns a new instance of File.



13
14
15
16
17
18
19
# File 'lib/brutal/manifest/file.rb', line 13

def initialize(pathname)
  unless pathname.fnmatch?(Name::SUFFIX_PATTERN, ::File::FNM_PATHNAME | ::File::FNM_DOTMATCH)
    raise ::ArgumentError
  end

  @yaml = pathname.read
end

Instance Attribute Details

#yamlObject (readonly)

Returns the value of attribute yaml.



11
12
13
# File 'lib/brutal/manifest/file.rb', line 11

def yaml
  @yaml
end

Instance Method Details

#parseObject



21
22
23
# File 'lib/brutal/manifest/file.rb', line 21

def parse
  ::YAML.safe_load(yaml, symbolize_names: false)
end