class Bake::Type::Array
Public Class Methods
Source
# File vendor/bundle/ruby/3.4.0/gems/bake-0.23.1/lib/bake/type/array.rb, line 13 def initialize(item_type) @item_type = item_type end
Public Instance Methods
Source
# File vendor/bundle/ruby/3.4.0/gems/bake-0.23.1/lib/bake/type/array.rb, line 17 def composite? true end
Source
# File vendor/bundle/ruby/3.4.0/gems/bake-0.23.1/lib/bake/type/array.rb, line 21 def map(values) values.map{|value| @item_type.parse(value)} end
Source
# File vendor/bundle/ruby/3.4.0/gems/bake-0.23.1/lib/bake/type/array.rb, line 25 def parse(input) case input when ::String return input.split(",").map{|value| @item_type.parse(value)} when ::Array return input.map{|value| @item_type.parse(value)} else raise ArgumentError, "Cannot coerce #{input.inspect} into array!" end end
Source
# File vendor/bundle/ruby/3.4.0/gems/bake-0.23.1/lib/bake/type/array.rb, line 36 def to_s "an Array of #{@item_type}" end