Module: Cnab::Helper
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name) ⇒ Object
3
4
5
6
|
# File 'lib/cnab/helper.rb', line 3
def method_missing(method_name)
return instance_variable_get("@#{method_name}") if instance_variable_defined?("@#{method_name}")
instance_variable_set("@#{method_name}", @line[@definition.send(method_name)].strip)
end
|
Instance Method Details
#inspect ⇒ Object
13
14
15
16
17
18
|
# File 'lib/cnab/helper.rb', line 13
def inspect
variables = instance_variables.map do |instance_variable|
"#{instance_variable.to_s.gsub('@', '')}: \"#{instance_variable_get(instance_variable)}\""
end.join(", ")
"<#{self.class.name} #{variables}>"
end
|
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
8
9
10
11
|
# File 'lib/cnab/helper.rb', line 8
def respond_to_missing?(method_name, include_private = false)
return true if definition.respond_to?(method_name)
super
end
|