Sha256: 34a1e310d60cd96337a9f4fd05949162aaf3dceb8f414bb6726853d2e4feca9e

Contents?: true

Size: 875 Bytes

Versions: 1

Compression:

Stored size: 875 Bytes

Contents

module Eco::Data::Locations
  NODE_PLAIN_ATTRS = %i[row_num id name parent_id weight archived archive_token]
  NodePlainStruct  = Struct.new(*NODE_PLAIN_ATTRS)
  # Class to treat input csv in a form of a list of nodes, where parent is specified.
  class NodePlain < NodePlainStruct
    include Eco::Data::Locations::NodeBase

    require_relative 'node_plain/parsing'
    require_relative 'node_plain/serial'
    require_relative 'node_plain/builder'
    extend Eco::Data::Locations::NodePlain::Builder

    ALL_ATTRS          = NODE_PLAIN_ATTRS
    ADDITIONAL_ATTRS   = %i[row_num]
    PROP_ATTRS         = ALL_ATTRS - ADDITIONAL_ATTRS

    def id
      clean_id(super)
    end

    def name
      super || self.id
    end

    def parentId
      self.parent_id
    end

    # backwards compatibility
    def tag
      id
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eco-helpers-2.5.3 lib/eco/data/locations/node_plain.rb