Method: Sexp#hash_values
- Defined in:
- lib/code_analyzer/sexp.rb
#hash_values ⇒ Array
Get the hash values.
s(:hash,
s(:assoclist_from_args,
s(
s(:assoc_new, s(:@label, "first_name:", s(1, 1)), s(:string_literal, s(:string_add, s(:string_content), s(:@tstring_content, "Richard", s(1, 14))))),
s(:assoc_new, s(:@label, "last_name:", s(1, 24)), s(:string_literal, s(:string_add, s(:string_content), s(:@tstring_content, "Huang", s(1, 36)))))
)
)
)
=> [
s(:string_literal, s(:string_add, s(:string_content), s(:@tstring_content, "Richard", s(1, 14)))),
s(:string_literal, s(:string_add, s(:string_content), s(:@tstring_content, "Huang", s(1, 36))))
]
674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 |
# File 'lib/code_analyzer/sexp.rb', line 674 def hash_values pair_nodes = case sexp_type when :bare_assoc_hash self[1] when :hash self[1][1] else end if pair_nodes values = [] pair_nodes.size.times { |i| values << pair_nodes[i][2] } values end end |