Sha256: e97b256445603f6ba49823873250937965caf58bf68348521b25d43013201cd7
Contents?: true
Size: 553 Bytes
Versions: 15
Compression:
Stored size: 553 Bytes
Contents
# frozen_string_literal: true require "core" module Tana module Models # A generic node. Node = Data.define :id, :name, :description, :type, :children do def self.for(**attributes) = new(**attributes.transform_keys!(nodeId: :id)) def initialize id:, type:, name: nil, description: nil, children: Core::EMPTY_ARRAY updated_children = children.map { |child| self.class.for(**child) } super id:, name:, type:, description:, children: updated_children end alias_method :to_hash, :to_h end end end
Version data entries
15 entries across 15 versions & 1 rubygems