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

Returns a new instance of DecomposerLoader.



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

def initialize(configuration)
  @configuration = configuration
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *arguments) ⇒ Object



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

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



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

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

#[]=(name, options) ⇒ Object



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

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

#namesObject



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

def names
  @configuration.names
end

#names=(names) ⇒ Object



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

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