Sha256: d29fbdd0c4e14d3dea71eab6a584bb962af885fcf9b9d98c7a8f9695de06b874

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

class TokyoMetro::App::Renderer::StationLinkList::English < TokyoMetro::App::Renderer::StationLinkList::MetaClass

  private

  def stations_grouped_by_first_letter
    @stations.values.group_by { | station |
      station[ :name_en ].first
    }
  end

  def proc_for_sorting_name_list_in_a_letter_category
    ::Proc.new { | station | station[ :name_en ] }
  end

  def proc_for_render_link
    ::Proc.new { | station |
      ::Station::Info.find_by( name_in_system: station[ :name_in_system ] ).decorate.render_link_to_station_page_en
    }
  end

  def domain_id
    :station_link_list_en
  end

  def domain_class_name_of_column
    [ :alphabet_column , :text_en ]
  end

  def domain_class_name_of_each_letter
    :alphabet
  end

  def groups_of_letters
    # letters = stations_grouped_by_first_letter.keys.sort
    # number_of_columns = 3
    # columns = letters.each_slice( ( letters.length / ( number_of_columns * 1.0 ) ).ceil ).to_a
    # columns
    [ "abcdefghij" , "klmnopqr" , "stuvwxyz" ].map { | str | str.upcase.split( // ) }
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokyo_metro-0.10.1 lib/tokyo_metro/app/renderer/station_link_list/english.rb