Class: Return
- Inherits:
-
Object
- Object
- Return
- Defined in:
- app/models/return.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
Returns the value of attribute items.
-
#order ⇒ Object
Returns the value of attribute order.
Instance Method Summary collapse
-
#initialize(order, items) ⇒ Return
constructor
A new instance of Return.
- #submit ⇒ Object
- #successful? ⇒ Boolean
Constructor Details
#initialize(order, items) ⇒ Return
Returns a new instance of Return.
4 5 6 7 |
# File 'app/models/return.rb', line 4 def initialize(order, items) self.order = order self.items = items end |
Instance Attribute Details
#items ⇒ Object
Returns the value of attribute items.
2 3 4 |
# File 'app/models/return.rb', line 2 def items @items end |
#order ⇒ Object
Returns the value of attribute order.
2 3 4 |
# File 'app/models/return.rb', line 2 def order @order end |
Instance Method Details
#submit ⇒ Object
9 10 11 12 13 |
# File 'app/models/return.rb', line 9 def submit @success = items.map(&:return!).reduce(&:&) rescue Transitions::InvalidTransition @success = false end |
#successful? ⇒ Boolean
15 16 17 |
# File 'app/models/return.rb', line 15 def successful? @success || false end |