Class: RubyRest::Format::Yaml
- Inherits:
-
Object
- Object
- RubyRest::Format::Yaml
- Defined in:
- lib/rubyrest/yaml.rb
Instance Method Summary collapse
-
#bind(object, source, params) ⇒ Object
Treats the object and the source as a hash, and updates the object.
- #format(model, params) ⇒ Object
-
#initialize(app) ⇒ Yaml
constructor
A new instance of Yaml.
- #parse_request(request) ⇒ Object
Constructor Details
#initialize(app) ⇒ Yaml
Returns a new instance of Yaml.
7 8 9 |
# File 'lib/rubyrest/yaml.rb', line 7 def initialize( app ) @app = app end |
Instance Method Details
#bind(object, source, params) ⇒ Object
Treats the object and the source as a hash, and updates the object
21 22 23 24 25 26 27 28 |
# File 'lib/rubyrest/yaml.rb', line 21 def bind( object, source, params ) # preprocesses the source hash # and updates the domain data resource = params[:resource] resource.process_request_data( source ) if resource.respond_to?( :process_request_data ) object.update( source ) end |
#format(model, params) ⇒ Object
11 12 13 |
# File 'lib/rubyrest/yaml.rb', line 11 def format( model, params ) model.to_yaml end |
#parse_request(request) ⇒ Object
15 16 17 |
# File 'lib/rubyrest/yaml.rb', line 15 def parse_request( request ) YAML::load( request ) end |