Sha256: 550f61516a6a670a7d6622de01b199465794f8cdae69fab5945c8daa57002982
Contents?: true
Size: 588 Bytes
Versions: 2
Compression:
Stored size: 588 Bytes
Contents
require 'json_builder/extensions' module JSONBuilder class Value attr_accessor :value def initialize(scope, arg, &block) if block_given? @value = Compiler.new(:scope => scope) compiled = @value.compile(arg, &block) # For the use case that the passed in block returns a non-member object # or normal Ruby object @value = compiled unless compiled.is_a?(Member) else @value = arg end end def to_s @value.respond_to?(:to_builder) ? @value.to_builder : @value.to_s end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
json_builder-3.0.6 | lib/json_builder/value.rb |
json_builder-3.0.4 | lib/json_builder/value.rb |