Class: Maestrano::OpenStruct
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Maestrano::OpenStruct
- Defined in:
- lib/maestrano/open_struct.rb
Overview
Extend OpenStruct to include a ‘attributes’ method
Instance Method Summary collapse
-
#attributes ⇒ Object
Return all object defined attributes.
Instance Method Details
#attributes ⇒ Object
Return all object defined attributes
5 6 7 8 9 10 11 |
# File 'lib/maestrano/open_struct.rb', line 5 def attributes if self.respond_to?(:to_h) self.to_h.keys else (self.methods - self.class.new.methods).reject {|method| method =~ /=$/ } end end |