Sha256: 712d1faa5098bc255cad816bff3f57d563beb1f351563aec42d2252de08fb220
Contents?: true
Size: 558 Bytes
Versions: 3
Compression:
Stored size: 558 Bytes
Contents
require 'json_builder/value' require 'json_builder/elements' module JSONBuilder class Member attr_accessor :key attr_accessor :value def initialize(key, scope, *args, &block) @key = key argument = args.shift if argument.is_a?(Array) || defined?(ActiveRecord::Relation) && argument.is_a?(ActiveRecord::Relation) @value = Elements.new(scope, argument, &block) else @value = Value.new(scope, argument, &block) end end def to_s "\"#{@key}\": #{@value}" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
json_builder-3.0.6 | lib/json_builder/member.rb |
json_builder-3.0.4 | lib/json_builder/member.rb |
json_builder-3.0.3 | lib/json_builder/member.rb |