<commit_before>class TokyoMetro::App::Renderer::WomenOnlyCarInfo < TokyoMetro::Factory::Decorate::MetaClass

  def initialize( request , railway_lines )
    super( request )
    @railway_lines = railway_lines
    set_infos
  end

  def render
    if @infos.present?
      h.render inline: <<-HAML , type: :haml , locals: h_locals
%div{ id: :women_only_car }
  = ::WomenOnlyCarInfoDecorator.render_sub_top_title
  - if infos.length > 1
    - infos.each do | infos_of_a_railway_line |
      = infos_of_a_railway_line.render( display_railway_line: true )
  - else
    = infos.first.render
      HAML
    end
  end

  private

  def set_infos
    if @railway_lines.instance_of?( ::RailwayLine )
      infos_in_db = ::WomenOnlyCarInfo.where( railway_line_id: @railway_lines.id )
    else
      infos_in_db = ::WomenOnlyCarInfo.where( railway_line_id: @railway_lines.pluck( :id ) )
    end

    @infos = infos_in_db.includes( :operation_day , :from_station_info , :to_station_info ).to_a.group_by( &:railway_line_id ).map { | railway_line_id , infos |
      ::TokyoMetro::App::Renderer::WomenOnlyCarInfo::EachRailwayLine.new( @request , @railway_lines.find( railway_line_id ) , infos )
    }
  end

  def h_locals
    super.merge({
      infos: @infos
    })
  end

end<commit_msg>20150516_012926 Bug fix and install gem (0.1.23)<commit_after>class TokyoMetro::App::Renderer::WomenOnlyCarInfo < TokyoMetro::Factory::Decorate::MetaClass

  def initialize( request , railway_lines )
    super( request )
    @railway_lines = railway_lines
    set_infos
  end

  def render
    if @infos.present?
      h.render inline: <<-HAML , type: :haml , locals: h_locals
%div{ id: :women_only_car }
  = ::WomenOnlyCarInfoDecorator.render_sub_top_title
  - if infos.length > 1
    - infos.each do | infos_of_a_railway_line |
      = infos_of_a_railway_line.render( display_railway_line: true )
  - else
    = infos.first.render
      HAML
    end
  end

  private

  def set_infos
    if @railway_lines.instance_of?( ::RailwayLine )
      infos_in_db = ::WomenOnlyCarInfo.where( railway_line_id: @railway_lines.id )
    else
      infos_in_db = ::WomenOnlyCarInfo.where( railway_line_id: @railway_lines.pluck( :id ) )
    end

    @infos = infos_in_db.includes( :operation_day , :from_station_info , :to_station_info ).to_a.group_by( &:railway_line_id ).map { | railway_line_id , infos |
      ::TokyoMetro::App::Renderer::WomenOnlyCarInfo::EachRailwayLine.new( @request , ::RailwayLine.find( railway_line_id ) , infos )
    }
  end

  def h_locals
    super.merge({
      infos: @infos
    })
  end

end
{'fraction_non_alphanumeric': 0.10874613003095976, 'fraction_numerical': 0.007739938080495356, 'mean_word_length': 3.691470054446461, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1785060', 'n_tokens_mistral': 1009, 'n_tokens_neox': 946, 'n_words': 169}