Sha256: b107572cd4cb6dcbbf3e25220785fe38ecec0184b2edae9c6129215459dc871c
Contents?: true
Size: 681 Bytes
Versions: 1
Compression:
Stored size: 681 Bytes
Contents
module Supa class Builder COMMANDS = %w(attribute object namespace collection).freeze COMMANDS.each do |command| klass = Supa::Commands.const_get(command.capitalize) define_method command do |name, options = {}, &block| klass.new( @object, tree: @tree, representer: @representer, name: name, options: options, &block ).represent end end def initialize(object, tree:, representer:) @object = object @tree = tree @representer = representer end def to_hash @tree.to_hash end def to_json to_hash.to_json end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
supa-0.2.0 | lib/supa/builder.rb |