Class: Rabl::Configuration
- Inherits:
-
Object
- Object
- Rabl::Configuration
- Defined in:
- lib/rabl/configuration.rb
Overview
Rabl.host
Constant Summary collapse
- DEFAULT_XML_OPTIONS =
{ :dasherize => true, :skip_types => false }
Instance Attribute Summary collapse
-
#bson_check_keys ⇒ Object
Returns the value of attribute bson_check_keys.
-
#bson_engine ⇒ Object
The Bson encoder/engine to use.
-
#bson_move_id ⇒ Object
Returns the value of attribute bson_move_id.
-
#cache_all_output ⇒ Object
Returns the value of attribute cache_all_output.
-
#cache_engine ⇒ Object
Returns the value of attribute cache_engine.
-
#cache_sources ⇒ Object
Returns the value of attribute cache_sources.
-
#enable_json_callbacks ⇒ Object
Returns the value of attribute enable_json_callbacks.
-
#escape_all_output ⇒ Object
Returns the value of attribute escape_all_output.
-
#include_bson_root ⇒ Object
Returns the value of attribute include_bson_root.
-
#include_child_root ⇒ Object
Returns the value of attribute include_child_root.
-
#include_json_root ⇒ Object
Returns the value of attribute include_json_root.
-
#include_msgpack_root ⇒ Object
Returns the value of attribute include_msgpack_root.
-
#include_plist_root ⇒ Object
Returns the value of attribute include_plist_root.
-
#include_xml_root ⇒ Object
Returns the value of attribute include_xml_root.
-
#msgpack_engine ⇒ Object
The MessagePack encoder/engine to use.
-
#plist_engine ⇒ Object
The Plist encoder/engine to use.
-
#view_paths ⇒ Object
Returns the value of attribute view_paths.
-
#xml_options ⇒ Object
writeonly
Sets the attribute xml_options.
Instance Method Summary collapse
-
#[](option) ⇒ Object
Allows config options to be read like a hash.
-
#default_xml_options ⇒ Object
Returns merged default and inputted xml options.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#json_engine ⇒ Object
The JSON engine used to encode Rabl templates into JSON.
- #json_engine=(engine_name_or_class) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/rabl/configuration.rb', line 43 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 end |
Instance Attribute Details
#bson_check_keys ⇒ Object
Returns the value of attribute bson_check_keys.
29 30 31 |
# File 'lib/rabl/configuration.rb', line 29 def bson_check_keys @bson_check_keys end |
#bson_engine ⇒ Object
Returns the Bson encoder/engine to use.
85 86 87 |
# File 'lib/rabl/configuration.rb', line 85 def bson_engine @bson_engine || ::BSON end |
#bson_move_id ⇒ Object
Returns the value of attribute bson_move_id.
30 31 32 |
# File 'lib/rabl/configuration.rb', line 30 def bson_move_id @bson_move_id end |
#cache_all_output ⇒ Object
Returns the value of attribute cache_all_output.
36 37 38 |
# File 'lib/rabl/configuration.rb', line 36 def cache_all_output @cache_all_output end |
#cache_engine ⇒ Object
Returns the value of attribute cache_engine.
39 40 41 |
# File 'lib/rabl/configuration.rb', line 39 def cache_engine @cache_engine end |
#cache_sources ⇒ Object
Returns the value of attribute cache_sources.
35 36 37 |
# File 'lib/rabl/configuration.rb', line 35 def cache_sources @cache_sources end |
#enable_json_callbacks ⇒ Object
Returns the value of attribute enable_json_callbacks.
28 29 30 |
# File 'lib/rabl/configuration.rb', line 28 def enable_json_callbacks @enable_json_callbacks end |
#escape_all_output ⇒ Object
Returns the value of attribute escape_all_output.
37 38 39 |
# File 'lib/rabl/configuration.rb', line 37 def escape_all_output @escape_all_output end |
#include_bson_root ⇒ Object
Returns the value of attribute include_bson_root.
27 28 29 |
# File 'lib/rabl/configuration.rb', line 27 def include_bson_root @include_bson_root end |
#include_child_root ⇒ Object
Returns the value of attribute include_child_root.
23 24 25 |
# File 'lib/rabl/configuration.rb', line 23 def include_child_root @include_child_root end |
#include_json_root ⇒ Object
Returns the value of attribute include_json_root.
22 23 24 |
# File 'lib/rabl/configuration.rb', line 22 def include_json_root @include_json_root end |
#include_msgpack_root ⇒ Object
Returns the value of attribute include_msgpack_root.
24 25 26 |
# File 'lib/rabl/configuration.rb', line 24 def include_msgpack_root @include_msgpack_root end |
#include_plist_root ⇒ Object
Returns the value of attribute include_plist_root.
25 26 27 |
# File 'lib/rabl/configuration.rb', line 25 def include_plist_root @include_plist_root end |
#include_xml_root ⇒ Object
Returns the value of attribute include_xml_root.
26 27 28 |
# File 'lib/rabl/configuration.rb', line 26 def include_xml_root @include_xml_root end |
#msgpack_engine ⇒ Object
Returns the MessagePack encoder/engine to use.
79 80 81 |
# File 'lib/rabl/configuration.rb', line 79 def msgpack_engine @msgpack_engine || ::MessagePack end |
#plist_engine ⇒ Object
Returns the Plist encoder/engine to use.
91 92 93 |
# File 'lib/rabl/configuration.rb', line 91 def plist_engine @plist_engine || ::Plist::Emit end |
#view_paths ⇒ Object
Returns the value of attribute view_paths.
38 39 40 |
# File 'lib/rabl/configuration.rb', line 38 def view_paths @view_paths end |
#xml_options=(value) ⇒ Object (writeonly)
Sets the attribute xml_options
34 35 36 |
# File 'lib/rabl/configuration.rb', line 34 def (value) @xml_options = value end |
Instance Method Details
#[](option) ⇒ Object
Allows config options to be read like a hash
98 99 100 |
# File 'lib/rabl/configuration.rb', line 98 def [](option) __send__(option) end |
#default_xml_options ⇒ Object
Returns merged default and inputted xml options
103 104 105 |
# File 'lib/rabl/configuration.rb', line 103 def @_default_xml_options ||= @xml_options.reverse_merge(DEFAULT_XML_OPTIONS) end |
#json_engine ⇒ Object
Returns The JSON engine used to encode Rabl templates into JSON.
73 74 75 |
# File 'lib/rabl/configuration.rb', line 73 def json_engine JsonEngine.instance.current_engine end |
#json_engine=(engine_name_or_class) ⇒ Object
68 69 70 |
# File 'lib/rabl/configuration.rb', line 68 def json_engine=(engine_name_or_class) JsonEngine.instance.set(engine_name_or_class) end |