Class: Maestrano::OpenStruct

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/maestrano/open_struct.rb

Overview

Extend OpenStruct to include a ‘attributes’ method

Instance Method Summary collapse

Instance Method Details

#attributesObject

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