Class: Slice

Inherits:
Object
  • Object
show all
Defined in:
lib/slicer/slice.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = nil, color = nil, value = nil) ⇒ Slice

Returns a new instance of Slice.



7
8
9
10
11
12
# File 'lib/slicer/slice.rb', line 7

def initialize(name = nil, color = nil, value = nil)
  self.name = name
  self.color = color
  self.value = value
  self.children = nil
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



2
3
4
# File 'lib/slicer/slice.rb', line 2

def children
  @children
end

#colourObject Also known as: color

Returns the value of attribute colour.



2
3
4
# File 'lib/slicer/slice.rb', line 2

def colour
  @colour
end

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/slicer/slice.rb', line 2

def name
  @name
end

#valueObject

Returns the value of attribute value.



2
3
4
# File 'lib/slicer/slice.rb', line 2

def value
  @value
end

Instance Method Details

#<<(slice) ⇒ Object



14
15
16
17
# File 'lib/slicer/slice.rb', line 14

def <<(slice)
  self.children = [] if self.children.nil?
  self.children << slice
end