Class: Hashie::Hash
- Inherits:
-
Hash
- Object
- Hash
- Hashie::Hash
- Defined in:
- lib/hive/extensions/hashie_hash.rb
Instance Method Summary collapse
Instance Method Details
#flexibly_convert_to_hash(object, options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/hive/extensions/hashie_hash.rb', line 3 def flexibly_convert_to_hash(object, = {}) if object.method(:to_hash).arity == 0 object.to_hash else object.to_hash() end rescue ArgumentError # HACK: If the provided object overrides the method() definition (see Hive::Activities::Messaging::Recipient) # we don't want the whole conversion to fail. So we assume execute the more likely to be present to_hash method. # I have opened an issue here: https://github.com/intridea/hashie/issues/222 object.to_hash end |