Sha256: ace2874621150cb0cb841c753b6435c27915af4378603b157ed1d1e90b148c79

Contents?: true

Size: 480 Bytes

Versions: 1

Compression:

Stored size: 480 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)
        @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

1 entries across 1 versions & 1 rubygems

Version Path
json_builder-3.0.2 lib/json_builder/member.rb