Class: SFCBus::Bus

Inherits:
Object
  • Object
show all
Defined in:
lib/sfcbus/bus.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Bus

Returns a new instance of Bus.



7
8
9
# File 'lib/sfcbus/bus.rb', line 7

def initialize(params)
  params.each { |k, v| instance_variable_set("@#{k}", v) }
end

Instance Attribute Details

#day_typeObject (readonly)

Returns the value of attribute day_type.



5
6
7
# File 'lib/sfcbus/bus.rb', line 5

def day_type
  @day_type
end

#fromObject (readonly)

Returns the value of attribute from.



5
6
7
# File 'lib/sfcbus/bus.rb', line 5

def from
  @from
end

#hourObject (readonly)

Returns the value of attribute hour.



5
6
7
# File 'lib/sfcbus/bus.rb', line 5

def hour
  @hour
end

#is_rotaryObject (readonly)

Returns the value of attribute is_rotary.



5
6
7
# File 'lib/sfcbus/bus.rb', line 5

def is_rotary
  @is_rotary
end

#minObject (readonly)

Returns the value of attribute min.



5
6
7
# File 'lib/sfcbus/bus.rb', line 5

def min
  @min
end

#toObject (readonly)

Returns the value of attribute to.



5
6
7
# File 'lib/sfcbus/bus.rb', line 5

def to
  @to
end

#typeObject (readonly)

Returns the value of attribute type.



5
6
7
# File 'lib/sfcbus/bus.rb', line 5

def type
  @type
end

Instance Method Details

#day_type_jpObject



27
28
29
# File 'lib/sfcbus/bus.rb', line 27

def day_type_jp
  SFCBus::DayTypes::JP[@day_type]
end

#from_jpObject



15
16
17
# File 'lib/sfcbus/bus.rb', line 15

def from_jp
  SFCBus::Locations::JP[@from]
end

#inspect_timeObject



31
32
33
# File 'lib/sfcbus/bus.rb', line 31

def inspect_time
  "#{@hour.to_s.rjust(2, '0')}:#{@min.to_s.rjust(2, '0')}"
end

#rotary?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/sfcbus/bus.rb', line 11

def rotary?
  @is_rotary
end

#to_jpObject



19
20
21
# File 'lib/sfcbus/bus.rb', line 19

def to_jp
  SFCBus::Locations::JP[@to]
end

#type_jpObject



23
24
25
# File 'lib/sfcbus/bus.rb', line 23

def type_jp
  SFCBus::Types::JP[@type]
end