Class: Blanket::Reader

Inherits:
Object
  • Object
show all
Defined in:
lib/blanket/config/reader.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Reader

Returns a new instance of Reader.



4
5
6
7
# File 'lib/blanket/config/reader.rb', line 4

def initialize(path)
  @path = path
  @attributes = YAML.load_file(@path)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol) ⇒ Object



9
10
11
12
13
# File 'lib/blanket/config/reader.rb', line 9

def method_missing(symbol)
  @attributes[symbol.to_s]
 rescue
   nil
end

Class Method Details

.blanketize(path) ⇒ Object



19
20
21
22
# File 'lib/blanket/config/reader.rb', line 19

def self.blanketize(path)
  reader = Reader.new(path)
  blanket_type.new(@attributes)
end

Instance Method Details

#keysObject



15
16
17
# File 'lib/blanket/config/reader.rb', line 15

def keys
  blanket_type.attribute_symbols
end