Class: Screening::Statistics
- Inherits:
-
Hash
- Object
- Hash
- Screening::Statistics
show all
- Defined in:
- lib/screening.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_id, *args, &block) ⇒ Object
116
117
118
119
120
121
122
123
124
|
# File 'lib/screening.rb', line 116
def method_missing(method_id, *args, &block)
method_id_chopped = method_id =~ /\=/ ? method_id.to_s.chop.to_sym : method_id
self.class.attr_hash method_id_chopped
if method_id =~ /\=/
__send__("#{method_id_chopped}=", args[0])
else
__send__(method_id_chopped)
end
end
|
Class Method Details
.attr_hash(method_hash) ⇒ Object
107
108
109
110
111
112
113
114
|
# File 'lib/screening.rb', line 107
def attr_hash(method_hash)
define_method(method_hash) do
self[method_hash]
end
define_method("#{method_hash}=") do |value|
self[method_hash] = value
end
end
|