Class: Mementus::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/mementus/node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: nil, label: nil, props: {}) ⇒ Node

Returns a new instance of Node.



5
6
7
8
9
# File 'lib/mementus/node.rb', line 5

def initialize(id: nil, label: nil, props: {})
  @id = id
  @label = label
  @props = props.freeze
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/mementus/node.rb', line 3

def id
  @id
end

#labelObject (readonly)

Returns the value of attribute label.



3
4
5
# File 'lib/mementus/node.rb', line 3

def label
  @label
end

#propsObject (readonly)

Returns the value of attribute props.



3
4
5
# File 'lib/mementus/node.rb', line 3

def props
  @props
end

Instance Method Details

#[](prop) ⇒ Object



11
12
13
# File 'lib/mementus/node.rb', line 11

def [](prop)
  @props[prop]
end