Sha256: c335458b95163b92e075c56da6d1dc153f3c7bbf05c2b06786400a2c6672abe0

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

class TokyoMetro::Factory::Convert::Customize::Api::TrainLocation::RomanceCar::Info < TokyoMetro::Factory::Convert::Common::Api::MetaClass::TrainInfos::RomanceCar::Info

  private

  def set_train_type
    if on_rails_application?
      generate_log_of_romance_car
    end
    super
  end

  def generate_log_of_romance_car
    case ::Rails.env
    when "development" , "test"
      _log_as_for_romance_car = log_as_for_romance_car
      puts _log_as_for_romance_car
      ::Rails.application.config.romance_car_logger.info( _log_as_for_romance_car )
    when "production"
      ::Rails.logger.info( "[Romance Car] #{ log_as_for_romance_car }" )
    end
  end

  def log_as_for_romance_car
    str_ary = ::Array.new
    str_ary << "[Before convert] Time: #{ ::TokyoMetro.time_now.to_s }"
    str_ary << "dc_date: #{ object.dc_date }"
    str_ary << "train_type: #{ object.train_type }"
    # str_ary << "Train name: #{ decorator.train_name }"
    begin
      case object.train_type
      when "odpt.TrainType:TokyoMetro.LimitedExpress"
        str_ary <<  object.inspect
      when "odpt.TrainType:TokyoMetro.RomanceCar"
        str_ary <<  object.inspect
      else
        raise
      end
    # train_type が不正の場合
    rescue
      str_ary <<  object.inspect
    end
    str_ary.join( " / " )
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokyo_metro-0.10.1 lib/tokyo_metro/factory/convert/customize/api/train_location/romance_car/info.rb