Method: Inch::CodeObject::Converter.to_hash
- Defined in:
- lib/inch/code_object/converter.rb
.to_hash(o) ⇒ Hash
Returns an attributes Hash for a given code object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/inch/code_object/converter.rb', line 71 def self.to_hash(o) attributes = {} OBJECT_ATTRIBUTES.each do |name| next unless o.respond_to?(name) attributes[name] = o.public_send(name) end attributes[:parameters] = o.parameters.map do |parameter| hash = {} PARAMETER_ATTRIBUTES.each do |pname| next unless parameter.respond_to?(pname) hash[pname] = parameter.public_send(pname) end hash end attributes end |