Class: TokyoMetro::Factory::Decorate::Api::TrainOperation::Common
- Inherits:
-
MetaClass::RealTime::Info
- Object
- RailsDecorateFactory
- MetaClass
- MetaClass::RealTime::Info
- TokyoMetro::Factory::Decorate::Api::TrainOperation::Common
- Defined in:
- lib/tokyo_metro/factory/decorate/api/train_operation/common.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#railway_line ⇒ Object
readonly
Returns the value of attribute railway_line.
-
#status_type ⇒ Object
readonly
Returns the value of attribute status_type.
Attributes inherited from MetaClass::RealTime::Info
Instance Method Summary collapse
-
#initialize(request, obj, railway_line, controller) ⇒ Common
constructor
A new instance of Common.
- #render ⇒ Object
- #render_status_icon_and_text ⇒ Object
Constructor Details
#initialize(request, obj, railway_line, controller) ⇒ Common
3 4 5 6 7 |
# File 'lib/tokyo_metro/factory/decorate/api/train_operation/common.rb', line 3 def initialize( request , obj , railway_line , controller ) super( request , obj ) @railway_line = railway_line @controller = controller end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
10 11 12 |
# File 'lib/tokyo_metro/factory/decorate/api/train_operation/common.rb', line 10 def controller @controller end |
#railway_line ⇒ Object (readonly)
Returns the value of attribute railway_line.
9 10 11 |
# File 'lib/tokyo_metro/factory/decorate/api/train_operation/common.rb', line 9 def railway_line @railway_line end |
#status_type ⇒ Object (readonly)
Returns the value of attribute status_type.
11 12 13 |
# File 'lib/tokyo_metro/factory/decorate/api/train_operation/common.rb', line 11 def status_type @status_type end |
Instance Method Details
#render ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/tokyo_metro/factory/decorate/api/train_operation/common.rb', line 13 def render h.render inline: "%li{ class: [ :train_operation_info , :railway_line , :clearfix ] }\n= this.railway_line.decorate.render_matrix( make_link_to_railway_line: true , size: :small , link_controller_name: this.controller )\n%div{ class: [ :status , this.status_type ] }\n %div{ class: :infos }\n = this.render_status_icon_and_text\n = this.render_status_additional_infos\n HAML\nend\n" , type: :haml , locals: { this: self } |
#render_status_icon_and_text ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/tokyo_metro/factory/decorate/api/train_operation/common.rb', line 24 def render_status_icon_and_text h.render inline: "%div{ class: :icon }<\n= ::TokyoMetro::App::Renderer::Icon.send( this.status_type , request , 3 ).render\n%div{ class: :text }\n%p{ class: :text_ja }<\n = this.status_text_ja\n%p{ class: :text_en }<\n = this.status_text_en\n HAML\nend\n" , type: :haml , locals: { this: self } |