Sha256: 291c5d5432fcd1fa493409cee3fed33140cac64ca82562c3b38799e33d53ef18

Contents?: true

Size: 546 Bytes

Versions: 5

Compression:

Stored size: 546 Bytes

Contents

module MetraSchedule
  class Stop
    attr_reader :station, :time

    def initialize(options={})
      unless options.has_key?(:station) and options.has_key?(:time)
        raise ArgumentError.new "Stop objects must have a station and a time"
      end
      @station = options[:station] if options.has_key?(:station)
      @time = options[:time] if options.has_key?(:time)
    end

    def is_after?(time)
      @time > time
    end

    def self.pretty_print(sym)
      sym.to_s.split("_").map {|s| s.capitalize}.join("\s")
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
metra_schedule-0.3.1 lib/metra/stop.rb
metra_schedule-0.3.0 lib/metra/stop.rb
metra_schedule-0.2.2 lib/metra/stop.rb
metra_schedule-0.2.1.2 lib/metra/stop.rb
metra_schedule-0.2.1 lib/metra/stop.rb