Sha256: cfe584d716f160e7f0f198360b1b39ffc37ef335bbe8a65f6904e2bf8d6560ac

Contents?: true

Size: 690 Bytes

Versions: 3

Compression:

Stored size: 690 Bytes

Contents

#!/usr/bin/env ruby
# -*- encoding : utf-8 -*-

require './lib/map.rb'


def assert(&block)
  block.call
end


###
m = Map.new
p m.add(
  :comments => [
    { :body => 'a' },
    { :body => 'b' },
  ],

  [:comments, 0] => {'title' => 'teh title', 'description' => 'description'},
  [:comments, 1] => {'description' => 'description'},
)
puts
puts
p :m => m


__END__
=begin

{"comments"=>
  [{"body"=>"a", "title"=>"teh title", "description"=>"description"},
     {"body"=>"b", "description"=>"description"}]}

=end


###
m = Map.new
p m.add(
  [:a, :b, :c] => 42,

  [:a, :b] => {:d => 42.0}
)
puts
puts
p m

=begin

  {"a"=>{"b"=>{"c"=>42, "d"=>42.0}}}

=end

Map.new.add
Map.new.add({})

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
map-6.0.1 a.rb
map-6.0.0 a.rb
map-5.8.0 a.rb