Class: Extract::HashBuilder
- Defined in:
- lib/src/extract/hash_builder.rb
Constant Summary collapse
- INTERNAL_FIELDS =
%i[array_of keep_if within unescape].freeze
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Extract::Base
Instance Method Details
#value(index = 0) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/src/extract/hash_builder.rb', line 7 def value(index = 0) path, props = node.to_h.values_at(:path, :props) hash = {} props.each do |field_name, nested_props| next unless valuable_field? field_name, nested_props, index value = ValueBuilder.new(Node.new(nested_props, path), extractor).value hash[field_name.to_sym] = value if value.present? end keep_hash?(hash, props) ? hash : nil end |