Class: TokyoMetro::Static::OperationDay::Info

Inherits:
Object
  • Object
show all
Includes:
ClassNameLibrary::Static::OperationDay, Modules::Common::ToFactory::Generate::Info, Modules::Common::ToFactory::Seed::Info
Defined in:
lib/tokyo_metro/static/operation_day/info.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Modules::Common::ToFactory::Seed::Info

#seed

Constructor Details

#initialize(name_ja, name_en, same_as) ⇒ Info

Returns a new instance of Info.



7
8
9
10
11
# File 'lib/tokyo_metro/static/operation_day/info.rb', line 7

def initialize( name_ja , name_en , same_as )
  @name_ja = name_ja
  @name_en = name_en
  @same_as = same_as
end

Instance Attribute Details

#name_enObject (readonly) Also known as: en

Returns the value of attribute name_en.



14
15
16
# File 'lib/tokyo_metro/static/operation_day/info.rb', line 14

def name_en
  @name_en
end

#name_jaObject (readonly) Also known as: ja

Returns the value of attribute name_ja.



13
14
15
# File 'lib/tokyo_metro/static/operation_day/info.rb', line 13

def name_ja
  @name_ja
end

#same_asObject (readonly)

Returns the value of attribute same_as.



15
16
17
# File 'lib/tokyo_metro/static/operation_day/info.rb', line 15

def same_as
  @same_as
end

Instance Method Details

#match?(operation_day) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/tokyo_metro/static/operation_day/info.rb', line 28

def match?( operation_day )
  self.to_a.include?( operation_day ) or @name_en.gsub( /\,? / , "_" ).downcase.to_s == operation_day.to_s
end

#to_aObject



20
21
22
# File 'lib/tokyo_metro/static/operation_day/info.rb', line 20

def to_a
  [ @name_ja , @name_en , @same_as ]
end

#to_hObject



24
25
26
# File 'lib/tokyo_metro/static/operation_day/info.rb', line 24

def to_h
  { name_ja: @name_ja , name_en: @name_en , same_as: @same_as }
end