Sha256: 2cd25ba93d7635ad40539014b707f9d79134c8a44280abaad73be305fd41c559

Contents?: true

Size: 932 Bytes

Versions: 1

Compression:

Stored size: 932 Bytes

Contents

module TokyoMetro::Factory::BeforeSeed::Api::MetaClass::Timetables::TrainTypeModules::ProcessPatterns

  extend ::ActiveSupport::Concern

  private

  # @!group クラスインスタンス変数を操作するためのインスタンスメソッド

  def add_pattern( train_type_id )
    self.class.add_pattern( self.class.train_type_pattern_class.new( train_type_id , *( self.to_a ) ) )
  end

  def pattern
    self.class.get_pattern( *( self.to_a ) )
  end

  # @!endgroup

  module ClassMethods

    def train_type_pattern_class
      ::TokyoMetro::Factory::BeforeSeed::Api::MetaClass::Timetables::TrainType::Pattern
    end

    # @!group クラスインスタンス変数を操作するためのクラスメソッド

    def add_pattern( pattern )
      @patterns.unshift( pattern )
    end

    def get_pattern( *variables )
      @patterns.find { | item | item.match?( *variables ) }
    end

    # @!endgroup

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tokyo_metro-0.10.1 lib/tokyo_metro/factory/before_seed/api/meta_class/timetables/train_type_modules/process_patterns.rb