class Rabl::Configuration

Rabl.host

Constants

DEFAULT_XML_OPTIONS

Attributes

bson_check_keys[RW]
bson_engine[W]
bson_move_id[RW]
cache_all_output[RW]
cache_engine[RW]
cache_sources[RW]
enable_json_callbacks[RW]
escape_all_output[RW]
exclude_empty_values_in_collections[RW]
exclude_nil_values[RW]
include_bson_root[RW]
include_child_root[RW]
include_json_root[RW]
include_msgpack_root[RW]
include_plist_root[RW]
include_xml_root[RW]
json_engine[W]
msgpack_engine[W]
perform_caching[RW]
plist_engine[W]
raise_on_missing_attribute[RW]
replace_empty_string_values_with_nil_values[RW]
replace_nil_values_with_empty_strings[RW]
use_read_multi[RW]
view_paths[RW]
xml_options[W]

Public Class Methods

new() click to toggle source
# File lib/rabl/configuration.rb, line 58
def initialize
  @include_json_root                            = true
  @include_child_root                           = true
  @include_msgpack_root                         = true
  @include_plist_root                           = true
  @include_xml_root                             = false
  @include_bson_root                            = true
  @enable_json_callbacks                        = false
  @bson_check_keys                              = false
  @bson_move_id                                 = false
  @json_engine                                  = nil
  @msgpack_engine                               = nil
  @bson_engine                                  = nil
  @plist_engine                                 = nil
  @xml_options                                  = {}
  @cache_sources                                = false
  @cache_all_output                             = false
  @escape_all_output                            = false
  @view_paths                                   = []
  @cache_engine                                 = Rabl::CacheEngine.new
  @perform_caching                              = false
  @use_read_multi                               = true
  @replace_nil_values_with_empty_strings        = false
  @replace_empty_string_values_with_nil_values  = false
  @exclude_nil_values                           = false
  @exclude_empty_values_in_collections          = false
end

Public Instance Methods

[](option) click to toggle source

Allows config options to be read like a hash

@param [Symbol] option Key for a given attribute

# File lib/rabl/configuration.rb, line 112
def [](option)
  __send__(option)
end
bson_engine() click to toggle source

@return the Bson encoder/engine to use.

# File lib/rabl/configuration.rb, line 99
def bson_engine
  @bson_engine || ::BSON
end
default_xml_options() click to toggle source

Returns merged default and inputted xml options

# File lib/rabl/configuration.rb, line 117
def default_xml_options
  @_default_xml_options ||= @xml_options.reverse_merge(DEFAULT_XML_OPTIONS)
end
json_engine() click to toggle source

@return The JSON engine used to encode Rabl templates into JSON

# File lib/rabl/configuration.rb, line 87
def json_engine
  @json_engine || (defined?(::Oj) ? ::Oj : ::JSON)
end
msgpack_engine() click to toggle source

@return the MessagePack encoder/engine to use.

# File lib/rabl/configuration.rb, line 93
def msgpack_engine
  @msgpack_engine || ::MessagePack
end
plist_engine() click to toggle source

@return the Plist encoder/engine to use.

# File lib/rabl/configuration.rb, line 105
def plist_engine
  @plist_engine || ::Plist::Emit
end