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, #to_s

Constructor Details

#initialize(name, condition) ⇒ Family

Returns a new instance of Family.



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

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.



4
5
6
# File 'lib/train/platforms/family.rb', line 4

def children
  @children
end

#conditionObject

Returns the value of attribute condition.



4
5
6
# File 'lib/train/platforms/family.rb', line 4

def condition
  @condition
end

#familiesObject

Returns the value of attribute families.



4
5
6
# File 'lib/train/platforms/family.rb', line 4

def families
  @families
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/train/platforms/family.rb', line 4

def name
  @name
end

Instance Method Details

#inspectObject



25
26
27
# File 'lib/train/platforms/family.rb', line 25

def inspect
  "%p[%s]" % [self.class, name]
end

#title(title = nil) ⇒ Object



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

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

  @title = title
  self
end