Class: ChupaText::ConfigurationLoader::DecomposerLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/chupa-text/configuration-loader.rb

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ DecomposerLoader


52
53
54
# File 'lib/chupa-text/configuration-loader.rb', line 52

def initialize(configuration)
  @configuration = configuration
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *arguments) ⇒ Object


72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/chupa-text/configuration-loader.rb', line 72

def method_missing(name, *arguments)
  return super if block_given?

  if name.to_s.end_with?("=") and arguments.size == 1
    value = arguments.first
    self[name.to_s.gsub(/=\z/, "")] = value
  elsif arguments.empty?
    self[name.to_s]
  else
    super
  end
end

Instance Method Details

#[](name) ⇒ Object


64
65
66
# File 'lib/chupa-text/configuration-loader.rb', line 64

def [](name)
  @configuration.options[name]
end

#[]=(name, options) ⇒ Object


68
69
70
# File 'lib/chupa-text/configuration-loader.rb', line 68

def []=(name, options)
  @configuration.options[name] = options
end

#namesObject


56
57
58
# File 'lib/chupa-text/configuration-loader.rb', line 56

def names
  @configuration.names
end

#names=(names) ⇒ Object


60
61
62
# File 'lib/chupa-text/configuration-loader.rb', line 60

def names=(names)
  @configuration.names = names
end