Class: BBMB::Html::State::Result::Result
- Inherits:
-
Object
- Object
- BBMB::Html::State::Result::Result
- Includes:
- Enumerable
- Defined in:
- lib/bbmb/html/state/result.rb
Instance Attribute Summary collapse
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#products ⇒ Object
readonly
Returns the value of attribute products.
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(order, products) ⇒ Result
constructor
A new instance of Result.
- #ordered_quantity(article_number) ⇒ Object
- #quota(article_id) ⇒ Object
- #reverse! ⇒ Object
- #size ⇒ Object
- #sort!(*args, &block) ⇒ Object
- #sort_by(&block) ⇒ Object
Constructor Details
#initialize(order, products) ⇒ Result
Returns a new instance of Result.
14 15 16 |
# File 'lib/bbmb/html/state/result.rb', line 14 def initialize(order, products) @order, @products = order, products end |
Instance Attribute Details
#order ⇒ Object (readonly)
Returns the value of attribute order.
13 14 15 |
# File 'lib/bbmb/html/state/result.rb', line 13 def order @order end |
#products ⇒ Object (readonly)
Returns the value of attribute products.
13 14 15 |
# File 'lib/bbmb/html/state/result.rb', line 13 def products @products end |
Instance Method Details
#each(&block) ⇒ Object
17 18 19 |
# File 'lib/bbmb/html/state/result.rb', line 17 def each(&block) @products.each(&block) end |
#empty? ⇒ Boolean
20 21 22 |
# File 'lib/bbmb/html/state/result.rb', line 20 def empty? @products.empty? end |
#ordered_quantity(article_number) ⇒ Object
23 24 25 |
# File 'lib/bbmb/html/state/result.rb', line 23 def ordered_quantity(article_number) @order.quantity(article_number) end |
#quota(article_id) ⇒ Object
26 27 28 |
# File 'lib/bbmb/html/state/result.rb', line 26 def quota(article_id) @order.quota(article_id) end |
#reverse! ⇒ Object
29 30 31 |
# File 'lib/bbmb/html/state/result.rb', line 29 def reverse! @products.reverse! end |
#size ⇒ Object
32 33 34 |
# File 'lib/bbmb/html/state/result.rb', line 32 def size @products.size end |
#sort!(*args, &block) ⇒ Object
39 40 41 |
# File 'lib/bbmb/html/state/result.rb', line 39 def sort!(*args, &block) @products.sort!(*args, &block) end |
#sort_by(&block) ⇒ Object
35 36 37 38 |
# File 'lib/bbmb/html/state/result.rb', line 35 def sort_by(&block) @products = @products.sort_by(&block) self end |