Sha256: bb4d082c2eb8f1a56bd073e1de2a7a06c11ceb6afd33384ffaf72c4037cca281
Contents?: true
Size: 1.46 KB
Versions: 13
Compression:
Stored size: 1.46 KB
Contents
module Eco::API::UseCases::GraphQL::Samples::Location::Service module TreeToList module Converter module Parser private # Adds up to the generic_node_parser # def custom_node_parser(node_hash) # node_hash.each do |key, val| # end # end def node_parser_block return @node_parser_block if instance_variable_defined?(:@node_parser_block) custom_before = custom_node_parser_before_block custom_after = custom_node_parser_block @node_parser_block = proc do |node_hash, node| node_hash.tap do custom_before&.call(node_hash, node) default_node_parse(node_hash, node) custom_after&.call(node_hash, node) end end end # Grabs the custom node parser that runs after the generic one def custom_node_parser_block return nil unless respond_to?(:custom_node_parser, true) method(:custom_node_parser) end def custom_node_parser_before_block return nil unless respond_to?(:custom_node_parser_before, true) method(:custom_node_parser_before) end # Generic parsing def default_node_parse(node_hash, _node) class_ids = to_classification_ids(node_hash['classifications']) node_hash['classifications'] = class_ids end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems