Class: CanTango::Loader::Yaml

Inherits:
Object
  • Object
show all
Defined in:
lib/cantango/loader/yaml.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_name) ⇒ Yaml

Returns a new instance of Yaml.



6
7
8
# File 'lib/cantango/loader/yaml.rb', line 6

def initialize file_name
  @file_name = file_name
end

Instance Attribute Details

#file_nameObject

Returns the value of attribute file_name.



4
5
6
# File 'lib/cantango/loader/yaml.rb', line 4

def file_name
  @file_name
end

Class Method Details

.inherited(subclass) ⇒ Object



10
11
12
# File 'lib/cantango/loader/yaml.rb', line 10

def self.inherited subclass
  subclass.extend ClassMethods
end

Instance Method Details

#parserObject

Raises:

  • (NotImplementedError)


14
15
16
# File 'lib/cantango/loader/yaml.rb', line 14

def parser
  raise NotImplementedError
end

#yml_contentObject



18
19
20
21
22
# File 'lib/cantango/loader/yaml.rb', line 18

def yml_content
  YAML.load_file(file_name)
rescue
  raise "Couldn't load YAML file: #{file_name}"
end