Class: Rzd::Train

Inherits:
Struct
  • Object
show all
Defined in:
lib/rzd/train.rb

Constant Summary collapse

SEATS =
['Л','К','П','С']

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



1
2
3
# File 'lib/rzd/train.rb', line 1

def name
  @name
end

#numObject

Returns the value of attribute num

Returns:

  • (Object)

    the current value of num



1
2
3
# File 'lib/rzd/train.rb', line 1

def num
  @num
end

#seatsObject

Returns the value of attribute seats

Returns:

  • (Object)

    the current value of seats



1
2
3
# File 'lib/rzd/train.rb', line 1

def seats
  @seats
end

Instance Method Details

#seat_tableObject



5
6
7
8
9
10
11
12
# File 'lib/rzd/train.rb', line 5

def seat_table
  str = ""
  SEATS.each do |s|
    str += seats.include?(s) ? s : " "
    str += " "
  end
  str
end