Class: FluidFeatures::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, environment = nil) ⇒ Config

Returns a new instance of Config.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fluidfeatures/config.rb', line 10

def initialize(source, environment=nil)
  if source.is_a? String
    init_from_file(source, environment)
  elsif source.is_a? Hash
    init_from_hash(source)
  else
    raise FFeaturesConfigInvalid.new(
      "Invalid 'source' given. Expected file path String or Hash. Got #{source.class}"
    )
  end
  if @vars["cache"] and @vars["cache"]["limit"]
    @vars["cache"]["limit"] = self.class.parse_file_size(vars["cache"]["limit"])
  end
end

Instance Attribute Details

#varsObject

Returns the value of attribute vars.



8
9
10
# File 'lib/fluidfeatures/config.rb', line 8

def vars
  @vars
end

Instance Method Details

#[](name) ⇒ Object



25
26
27
# File 'lib/fluidfeatures/config.rb', line 25

def [](name)
  @vars[name.to_s]
end