Class: Metro::Parameters::Options
- Inherits:
-
Object
- Object
- Metro::Parameters::Options
- Defined in:
- lib/metro/parameters/options.rb
Overview
Options are the result of a parameters parser. The options class defines a read-only structure that provides getters for all the parameters specified within the has.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Options
constructor
A new instance of Options.
- #method_missing(name, *args, &block) ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Options
Returns a new instance of Options.
12 13 14 15 16 17 |
# File 'lib/metro/parameters/options.rb', line 12 def initialize(params = {}) params.each do |key,value| self.class.send(:define_method,key) { value } self.class.send(:define_method,"#{key}?") { value } end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
19 20 21 |
# File 'lib/metro/parameters/options.rb', line 19 def method_missing(name,*args,&block) return false end |