Sha256: 6f8669ead06c9a883187857d0d0680871dfa19e4a7209fbb7a47f6e8f547e1ab

Contents?: true

Size: 366 Bytes

Versions: 4

Compression:

Stored size: 366 Bytes

Contents

module Relax
  class Parameter
    attr_reader :name, :options
    attr_writer :value

    def initialize(name, options={})
      @name = name
      @options = options
    end

    def named?(name)
      name == (@options[:as] || @name)
    end

    def value
      @value || @options[:default]
    end

    def required?
      @options[:required]
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
tylerhunt-relax-0.1.2 lib/relax/parameter.rb
tylerhunt-relax-0.1.3 lib/relax/parameter.rb
relax-0.1.3 lib/relax/parameter.rb
relax-0.1.2 lib/relax/parameter.rb