Class: HashWrapper
- Inherits:
-
Object
- Object
- HashWrapper
- Defined in:
- app/models/list_export.rb
Instance Method Summary collapse
-
#initialize(hash) ⇒ HashWrapper
constructor
A new instance of HashWrapper.
-
#method_missing(method_name, *args, &block) ⇒ Object
This is a workaround for the to_xls gem, which requires to access the attributes by method in order to write the columns in the correct order.
Constructor Details
#initialize(hash) ⇒ HashWrapper
Returns a new instance of HashWrapper.
285 286 287 |
# File 'app/models/list_export.rb', line 285 def initialize(hash) @hash = hash end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
This is a workaround for the to_xls gem, which requires to access the attributes by method in order to write the columns in the correct order.
292 293 294 |
# File 'app/models/list_export.rb', line 292 def method_missing(method_name, *args, &block) @hash[method_name] || @hash[method_name.to_sym] end |