Class: SomethingAndNothing::ListDisplayHelper
- Inherits:
-
Object
- Object
- SomethingAndNothing::ListDisplayHelper
- Defined in:
- lib/something_and_nothing/list_display_helper.rb
Instance Attribute Summary collapse
-
#list ⇒ Object
readonly
Returns the value of attribute list.
Instance Method Summary collapse
-
#initialize(list) ⇒ ListDisplayHelper
constructor
A new instance of ListDisplayHelper.
- #more_than_one ⇒ Object
- #populated ⇒ Object
- #single ⇒ Object
- #unpopulated ⇒ Object
Constructor Details
#initialize(list) ⇒ ListDisplayHelper
Returns a new instance of ListDisplayHelper.
5 6 7 |
# File 'lib/something_and_nothing/list_display_helper.rb', line 5 def initialize(list) @list = list end |
Instance Attribute Details
#list ⇒ Object (readonly)
Returns the value of attribute list.
3 4 5 |
# File 'lib/something_and_nothing/list_display_helper.rb', line 3 def list @list end |
Instance Method Details
#more_than_one ⇒ Object
21 22 23 |
# File 'lib/something_and_nothing/list_display_helper.rb', line 21 def more_than_one yield if block_given? && @list.length > 1 end |
#populated ⇒ Object
9 10 11 |
# File 'lib/something_and_nothing/list_display_helper.rb', line 9 def populated yield if block_given? && @list.length > 0 end |
#single ⇒ Object
17 18 19 |
# File 'lib/something_and_nothing/list_display_helper.rb', line 17 def single yield if block_given? && @list.length == 1 end |
#unpopulated ⇒ Object
13 14 15 |
# File 'lib/something_and_nothing/list_display_helper.rb', line 13 def unpopulated yield if block_given? && @list.length == 0 end |