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
-
#enable_json_callbacks ⇒ Object
Returns the value of attribute enable_json_callbacks.
-
#include_json_root ⇒ Object
Returns the value of attribute include_json_root.
-
#include_xml_root ⇒ Object
Returns the value of attribute include_xml_root.
-
#json_engine ⇒ Object
Returns the value of attribute json_engine.
-
#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.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
12 13 14 15 16 17 18 |
# File 'lib/rabl/configuration.rb', line 12 def initialize @include_json_root = true @include_xml_root = false @enable_json_callbacks = false @json_engine = nil @xml_options = {} end |
Instance Attribute Details
#enable_json_callbacks ⇒ Object
Returns the value of attribute enable_json_callbacks.
6 7 8 |
# File 'lib/rabl/configuration.rb', line 6 def enable_json_callbacks @enable_json_callbacks end |
#include_json_root ⇒ Object
Returns the value of attribute include_json_root.
4 5 6 |
# File 'lib/rabl/configuration.rb', line 4 def include_json_root @include_json_root end |
#include_xml_root ⇒ Object
Returns the value of attribute include_xml_root.
5 6 7 |
# File 'lib/rabl/configuration.rb', line 5 def include_xml_root @include_xml_root end |
#json_engine ⇒ Object
Returns the value of attribute json_engine.
7 8 9 |
# File 'lib/rabl/configuration.rb', line 7 def json_engine @json_engine end |
#xml_options=(value) ⇒ Object (writeonly)
Sets the attribute xml_options
8 9 10 |
# File 'lib/rabl/configuration.rb', line 8 def (value) @xml_options = value end |
Instance Method Details
#[](option) ⇒ Object
Allows config options to be read like a hash
23 24 25 |
# File 'lib/rabl/configuration.rb', line 23 def [](option) send(option) end |
#default_xml_options ⇒ Object
Returns merged default and inputted xml options
28 29 30 |
# File 'lib/rabl/configuration.rb', line 28 def @_default_xml_options ||= @xml_options.reverse_merge(DEFAULT_XML_OPTIONS) end |