Sha256: cafc440da115c7fd0efd8c9875618da74c6a439ea5eb94b0ff8c602166a08257

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

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

  private

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

  def proc_for_sorting_name_list_in_a_letter_category
    ::Proc.new { | station | station[ :name_hira ].remove_dakuten }
  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_ja
    }
  end

  def domain_id
    :station_link_list_ja
  end

  def domain_class_name_of_column
    [ :hiragana_column , :text_ja ]
  end

  def domain_class_name_of_each_letter
    :hiragana
  end

  def groups_of_letters
    # letters = stations_grouped_by_first_letter.keys.sort
    # letters = letters.reverse
    # number_of_columns = 3
    # columns = letters.each_slice( ( letters.length / ( number_of_columns * 1.0 ) ).ceil ).to_a
    # columns.reverse.map( &:reverse )
    [ "あいうえおかきくけ" , "こさしすせそなに" , "ぬねのはひふへほまみむめもやゆよらりるれろわ" ].map { | str | str.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/japanese.rb