Class: Dao::Result
- Inherits:
-
Map
- Object
- Map
- Dao::Result
- Defined in:
- lib/dao/result.rb
Instance Method Summary collapse
- #error! ⇒ Object
- #form ⇒ Object
-
#initialize(*args, &block) ⇒ Result
constructor
A new instance of Result.
-
#inspect ⇒ Object
look good for inspect.
Constructor Details
#initialize(*args, &block) ⇒ Result
Returns a new instance of Result.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/dao/result.rb', line 3 def initialize(*args, &block) = Dao.(args) self.path = args.shift || [:path] || Path.default self.route = [:route] || Route.default self.mode = [:mode] || Mode.default self.status = [:status] || Status.default self.errors = [:errors] || Errors.new self.params = [:params] || Params.new self.data = [:data] || Data.new params.result = self params.path = self.path params.status = self.status params.errors = self.errors end |
Instance Method Details
#error! ⇒ Object
20 21 22 |
# File 'lib/dao/result.rb', line 20 def error! raise Dao::Error::Result.for(self) end |
#form ⇒ Object
40 41 42 |
# File 'lib/dao/result.rb', line 40 def form params.form end |
#inspect ⇒ Object
look good for inspect
26 27 28 |
# File 'lib/dao/result.rb', line 26 def inspect ::JSON.pretty_generate(self, :max_nesting => 0) end |