lib/maestrano/open_struct.rb in maestrano-0.12.5 vs lib/maestrano/open_struct.rb in maestrano-1.0.0.pre.RC1

- old
+ new

@@ -1,9 +1,13 @@ module Maestrano # Extend OpenStruct to include a 'attributes' method class OpenStruct < ::OpenStruct # Return all object defined attributes def attributes - (self.methods - self.class.new.methods).reject {|method| method =~ /=$/ } + if self.respond_to?(:to_h) + self.to_h.keys + else + (self.methods - self.class.new.methods).reject {|method| method =~ /=$/ } + end end end end