Sha256: 4b4a912348099bfd33c60c990b3c7d95c95475a5fda390e16ec6915b9391697c

Contents?: true

Size: 484 Bytes

Versions: 2

Compression:

Stored size: 484 Bytes

Contents

class Container
  def initialize validator=nil
    @node_dsls = {}
    @validator = validator || ->(_, _){}
  end

  def method_missing m, *args, &blk
    if m.to_s.last == "=" # assignment
      @node_dsls[m.to_s[0..-2]] = args.first
    else
      node_dsl = @node_dsls[m.to_s]
      rel_properties = args.first
      @recipient.add_node_dsl node_dsl, rel_properties
      node_dsl
    end
  end

  def set_recipient_of_node_dsl children_dsl
    @recipient = children_dsl
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
geoff-0.0.3.beta lib/geoff/container.rb
geoff-0.0.2.beta lib/geoff/container.rb