Class: TokyoMetro::App::Renderer::PassengerSurvey::Table::Station::Row

Inherits:
MetaClass::Row show all
Defined in:
lib/tokyo_metro/app/renderer/passenger_survey/table/station/row.rb

Instance Method Summary collapse

Methods inherited from MetaClass::Row

rectangle_height, #render_order, #render_svg_domain_in_table

Constructor Details

#initialize(request, passenger_survey_info, n, max_passenger_journey_in_graph, make_graph, passenger_survey_infos_all) ⇒ Row

Returns a new instance of Row.



3
4
5
6
7
8
9
10
11
# File 'lib/tokyo_metro/app/renderer/passenger_survey/table/station/row.rb', line 3

def initialize(
  request ,
  passenger_survey_info , n , max_passenger_journey_in_graph , make_graph ,
  passenger_survey_infos_all
)
  super( request , passenger_survey_info , n , max_passenger_journey_in_graph , make_graph )

  set_order( passenger_survey_infos_all )
end

Instance Method Details

#renderObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/tokyo_metro/app/renderer/passenger_survey/table/station/row.rb', line 13

def render
  h.render inline: <<-HAML , type: :haml , locals: h_locals
%tr{ class: [ :passenger_survey_table_row , cycle( :odd_row , :even_row ) ] , "data-href" => passenger_survey_info.station_page_name }
- passenger_survey_info_decorated = passenger_survey_info.decorate
= passenger_survey_info_decorated.render_station_name_in_table
= passenger_survey_info_decorated.render_survey_year_in_table
= passenger_survey_info_decorated.render_passenger_journeys
= this.render_svg_domain_in_table
= this.render_order
  HAML
end

#set_order(passenger_survey_infos_all) ⇒ Object



25
26
27
# File 'lib/tokyo_metro/app/renderer/passenger_survey/table/station/row.rb', line 25

def set_order( passenger_survey_infos_all)
  @order = passenger_survey_infos_all.where( 'survey_year = ? AND passenger_journeys > ?' , @passenger_survey_info.survey_year , @passenger_survey_info.passenger_journeys ).count + 1
end