Module: DataBindings

Defined in:
lib/data_bindings.rb,
lib/data_bindings/util.rb,
lib/data_bindings/bound.rb,
lib/data_bindings/unbound.rb,
lib/data_bindings/version.rb,
lib/data_bindings/adapters.rb,
lib/data_bindings/generator.rb,
lib/data_bindings/converters.rb,
lib/data_bindings/adapters/xml.rb,
lib/data_bindings/adapters/bson.rb,
lib/data_bindings/adapters/json.rb,
lib/data_bindings/adapters/ruby.rb,
lib/data_bindings/adapters/yaml.rb,
lib/data_bindings/adapters/native.rb,
lib/data_bindings/adapters/params.rb,
lib/data_bindings/adapters/tnetstring.rb

Overview

Top-level constant for DataBindings

Defined Under Namespace

Modules: Adapters, Bound, ConverterHelper, GemRequirement, Readers, Unbound, Writers, WritingInterceptor Classes: DefaultGenerator, FailedValidation, Generator, HttpError, IndifferentHash

Constant Summary collapse

DefaultGeneratorInstance =

Generator instance used by default when you make a call to DataBindings. This can act as a singleton, so, if you want your own generator, create an instance of it

DefaultGenerator.new
UnboundError =
Class.new(RuntimeError)
UnknownAdapterError =
Class.new(RuntimeError)
UnknownBindingError =
Class.new(RuntimeError)
BindingMismatch =
Class.new(RuntimeError)
VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.method_missing(m, *args, &blk) ⇒ Object

Sends all methods calls to DefaultGenerator



26
27
28
# File 'lib/data_bindings.rb', line 26

def method_missing(m, *args, &blk)
  DefaultGeneratorInstance.send(m, *args, &blk)
end

.primitive_value?(val) ⇒ Boolean

Returns:

  • (Boolean)


38
39
40
41
42
43
44
45
# File 'lib/data_bindings.rb', line 38

def primitive_value?(val)
  case val
  when Integer, Float, true, false, String, Symbol, nil
    true
  else
    false
  end
end

.true_boolean?(el) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/data_bindings.rb', line 34

def true_boolean?(el)
  el == true or el == 'true' or el == 1 or el == '1' or el == 'yes'
end

.type(name, &blk) ⇒ Object



30
31
32
# File 'lib/data_bindings.rb', line 30

def type(name, &blk)
  DefaultGeneratorInstance.type(name, &blk)
end