Class: Wmiirc::Config

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

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Config) initialize(file)

Returns a new instance of Config



9
10
11
# File 'lib/wmiirc/config.rb', line 9

def initialize file
  Import.import self, file, @origins={}
end

Instance Attribute Details

- (Object) origins (readonly)

Returns the value of attribute origins



7
8
9
# File 'lib/wmiirc/config.rb', line 7

def origins
  @origins
end

- (Object) shortcuts (readonly)

Returns the value of attribute shortcuts



7
8
9
# File 'lib/wmiirc/config.rb', line 7

def shortcuts
  @shortcuts
end

Instance Method Details

- (Object) apply



13
14
15
16
17
18
# File 'lib/wmiirc/config.rb', line 13

def apply
  script 'before'
  display
  control
  script 'after'
end

- (Object) origin(value, section)

Qualifies the given section name with the YAML file from which the given value originated. If this is not possible, the given section name is returned.



25
26
27
28
29
30
31
# File 'lib/wmiirc/config.rb', line 25

def origin value, section
  if origin = @origins[value]
    "#{origin}:#{section}"
  else
    section
  end
end