Class: Metro::Parameters::Options

Inherits:
Object
  • Object
show all
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

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