Sha256: 5b6aba0a4974357411c0fa065a2e419d5aa0a39df91104b0859c0b5192b657b2

Contents?: true

Size: 633 Bytes

Versions: 1

Compression:

Stored size: 633 Bytes

Contents

require 'json'

module Videojuicer
  module Resource
    module Types
      
      class Base
        def self.load(value)
          return self.new(value)
        end

        def initialize(value)
          @raw = value
        end
        
        # Returns the source value
        attr_reader :raw
      end

      class Options < Base
        def dump
          JSON.dump(raw)
        end
      end
      
      class Boolean < Base
        # Boolean.new("1").dump #=> true
        # Returns the coerced value
        def dump
          [1, "1", "true", "yes"].include?(raw)
        end        
      end
    
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vj-sdk-0.8.0.1 lib/videojuicer/resource/types.rb