Sha256: b1181c0bfff784947fe32e90f49b0fb268b831586ad90ca0d2a434375b388018

Contents?: true

Size: 764 Bytes

Versions: 1

Compression:

Stored size: 764 Bytes

Contents

module Hashmake

class ArrayArgSpec
  
  attr_reader :arg_spec
  
  def initialize hashed_args = {}
    hashed_args = { :default => ->(){ [] } }.merge hashed_args
    @arg_spec = ArgSpec.new hashed_args
  end
  
  def type
    @arg_spec.type
  end
  
  def validator
    @arg_spec.validator
  end
  
  def reqd
    @arg_spec.reqd
  end
  
  def default
    @arg_spec.default
  end
  
  def hash_make_if_needed val
    val.each_index do |i|
      item = val[i]
      val[i] = @arg_spec.hash_make_if_needed item
    end
  end
  
  def validate_value val
    val.each do |item|
      @arg_spec.validate_value item
    end
  end
  
  def make_hash_if_possible ary
    ary.each_index do |i|
      ary[i] = @arg_spec.make_hash_if_possible ary[i]
    end
  end
end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hashmake-0.2.0 lib/hashmake/array_arg_spec.rb