Sha256: 309ced8a6e8637577447507de20b8f66d44bf1ab5261bbe74ce62998ad154949

Contents?: true

Size: 922 Bytes

Versions: 1

Compression:

Stored size: 922 Bytes

Contents

class TokyoMetro::Factory::Convert::Customize::Api::Fare::ChiyodaBranchLine::KitaAyase::Info < TokyoMetro::Factory::Convert::Common::Api::MetaClass::Fundamental::Normal

  REGEXP = /Chiyoda(?=\.KitaAyase(?:\.|\Z))/

  def process
    if to_process_from_station?
      replace_same_as
      replace_from_station
    elsif to_process_to_station?
      replace_same_as
      replace_to_station
    end
  end

  private

  [ :from_station , :to_station ].each do | method_basename |
    eval <<-DEF
      def to_process_#{ method_basename }?
        REGEXP === @object.#{ method_basename }
      end
    DEF
  end

  [ :same_as , :from_station , :to_station ].each do | method_basename |
    eval <<-DEF
      def replace_#{ method_basename }
        new_var = @object.#{ method_basename }.gsub( REGEXP , "ChiyodaBranch" )
        @object.instance_variable_set( :@#{ method_basename } , new_var )
      end
    DEF
  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/fare/chiyoda_branch_line/kita_ayase/info.rb