Class: Uh::Layout::History
- Inherits:
-
Object
- Object
- Uh::Layout::History
- Defined in:
- lib/uh/layout/history.rb
Constant Summary collapse
- VIEWS_SIZE_MAX =
8
Instance Attribute Summary collapse
-
#views ⇒ Object
readonly
Returns the value of attribute views.
-
#views_size_max ⇒ Object
readonly
Returns the value of attribute views_size_max.
Instance Method Summary collapse
-
#initialize(views = [], views_size_max: VIEWS_SIZE_MAX) ⇒ History
constructor
A new instance of History.
- #last_view ⇒ Object
- #record_view(view) ⇒ Object
Constructor Details
#initialize(views = [], views_size_max: VIEWS_SIZE_MAX) ⇒ History
Returns a new instance of History.
8 9 10 11 |
# File 'lib/uh/layout/history.rb', line 8 def initialize views = [], views_size_max: VIEWS_SIZE_MAX @views = views @views_size_max = views_size_max end |
Instance Attribute Details
#views ⇒ Object (readonly)
Returns the value of attribute views.
6 7 8 |
# File 'lib/uh/layout/history.rb', line 6 def views @views end |
#views_size_max ⇒ Object (readonly)
Returns the value of attribute views_size_max.
6 7 8 |
# File 'lib/uh/layout/history.rb', line 6 def views_size_max @views_size_max end |
Instance Method Details
#last_view ⇒ Object
20 21 22 |
# File 'lib/uh/layout/history.rb', line 20 def last_view @views.last end |
#record_view(view) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/uh/layout/history.rb', line 13 def record_view view @views << view if @views.size > @views_size_max @views = @views.drop @views.size - @views_size_max end end |