Class: Train::Platforms::Family

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/train/platforms/family.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Common

#detect, #in_family

Constructor Details

#initialize(name, condition) ⇒ Family

Returns a new instance of Family.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/train/platforms/family.rb', line 8

def initialize(name, condition)
  @name = name
  @condition = condition
  @families = {}
  @children = {}
  @detect = nil
  @title = "#{name.to_s.capitalize} Family"

  # add itself to the families list
  Train::Platforms.families[@name.to_s] = self
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



6
7
8
# File 'lib/train/platforms/family.rb', line 6

def children
  @children
end

#conditionObject

Returns the value of attribute condition.



6
7
8
# File 'lib/train/platforms/family.rb', line 6

def condition
  @condition
end

#familiesObject

Returns the value of attribute families.



6
7
8
# File 'lib/train/platforms/family.rb', line 6

def families
  @families
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/train/platforms/family.rb', line 6

def name
  @name
end

Instance Method Details

#title(title = nil) ⇒ Object



20
21
22
23
24
# File 'lib/train/platforms/family.rb', line 20

def title(title = nil)
  return @title if title.nil?
  @title = title
  self
end