Class: Eclair::Column
- Inherits:
-
Object
- Object
- Eclair::Column
- Includes:
- CommonHelper
- Defined in:
- lib/eclair/column.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
Returns the value of attribute items.
-
#scroll ⇒ Object
Returns the value of attribute scroll.
Instance Method Summary collapse
- #<<(item) ⇒ Object
- #drawable?(y) ⇒ Boolean
- #expand ⇒ Object
-
#initialize(index) ⇒ Column
constructor
A new instance of Column.
- #rescroll(y) ⇒ Object
- #x ⇒ Object
Methods included from CommonHelper
Constructor Details
#initialize(index) ⇒ Column
Returns a new instance of Column.
8 9 10 11 12 |
# File 'lib/eclair/column.rb', line 8 def initialize index @index = index @items = [] @scroll = 0 end |
Instance Attribute Details
#items ⇒ Object
Returns the value of attribute items.
6 7 8 |
# File 'lib/eclair/column.rb', line 6 def items @items end |
#scroll ⇒ Object
Returns the value of attribute scroll.
5 6 7 |
# File 'lib/eclair/column.rb', line 5 def scroll @scroll end |
Instance Method Details
#<<(item) ⇒ Object
14 15 16 |
# File 'lib/eclair/column.rb', line 14 def << item @items << item end |
#drawable?(y) ⇒ Boolean
22 23 24 |
# File 'lib/eclair/column.rb', line 22 def drawable? y (@scroll...Grid.maxy+@scroll).include? y end |
#expand ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/eclair/column.rb', line 37 def = [] if config.group_by @items.each do |item| << item item.each do |instance| << instance end end else @items end end |
#rescroll(y) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/eclair/column.rb', line 26 def rescroll y if y < @scroll @scroll = y elsif y >= Grid.maxy @scroll = y - Grid.maxy + 1 end .each do |i| i.render end end |
#x ⇒ Object
18 19 20 |
# File 'lib/eclair/column.rb', line 18 def x @index end |