Class: Charming::Layout::PaneBehavior
- Inherits:
-
Object
- Object
- Charming::Layout::PaneBehavior
- Defined in:
- lib/charming/presentation/layout/pane_behavior.rb
Overview
PaneBehavior holds the render-time options that control a Pane’s interaction with the focus ring and the embedded Viewport.
Instance Attribute Summary collapse
-
#clip ⇒ Object
readonly
Returns the value of attribute clip.
-
#focus ⇒ Object
readonly
Returns the value of attribute focus.
-
#scroll ⇒ Object
readonly
Returns the value of attribute scroll.
-
#wrap ⇒ Object
readonly
Returns the value of attribute wrap.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #focusable? ⇒ Boolean
- #hash ⇒ Object
-
#initialize(focus:, scroll:, clip:, wrap:) ⇒ PaneBehavior
constructor
A new instance of PaneBehavior.
- #should_viewport? ⇒ Boolean
Constructor Details
#initialize(focus:, scroll:, clip:, wrap:) ⇒ PaneBehavior
Returns a new instance of PaneBehavior.
14 15 16 17 |
# File 'lib/charming/presentation/layout/pane_behavior.rb', line 14 def initialize(focus:, scroll:, clip:, wrap:) @focus, @scroll, @clip, @wrap = focus, scroll, clip, wrap freeze end |
Instance Attribute Details
#clip ⇒ Object (readonly)
Returns the value of attribute clip.
8 9 10 |
# File 'lib/charming/presentation/layout/pane_behavior.rb', line 8 def clip @clip end |
#focus ⇒ Object (readonly)
Returns the value of attribute focus.
8 9 10 |
# File 'lib/charming/presentation/layout/pane_behavior.rb', line 8 def focus @focus end |
#scroll ⇒ Object (readonly)
Returns the value of attribute scroll.
8 9 10 |
# File 'lib/charming/presentation/layout/pane_behavior.rb', line 8 def scroll @scroll end |
#wrap ⇒ Object (readonly)
Returns the value of attribute wrap.
8 9 10 |
# File 'lib/charming/presentation/layout/pane_behavior.rb', line 8 def wrap @wrap end |
Class Method Details
.build(focus: false, scroll: false, clip: true, wrap: false) ⇒ Object
10 11 12 |
# File 'lib/charming/presentation/layout/pane_behavior.rb', line 10 def self.build(focus: false, scroll: false, clip: true, wrap: false) new(focus: focus, scroll: scroll, clip: clip, wrap: wrap) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
19 20 21 22 23 |
# File 'lib/charming/presentation/layout/pane_behavior.rb', line 19 def ==(other) other.is_a?(PaneBehavior) && focus == other.focus && scroll == other.scroll && clip == other.clip && wrap == other.wrap end |
#focusable? ⇒ Boolean
30 31 32 |
# File 'lib/charming/presentation/layout/pane_behavior.rb', line 30 def focusable? focus end |
#hash ⇒ Object
26 27 28 |
# File 'lib/charming/presentation/layout/pane_behavior.rb', line 26 def hash [focus, scroll, clip, wrap].hash end |
#should_viewport? ⇒ Boolean
34 35 36 |
# File 'lib/charming/presentation/layout/pane_behavior.rb', line 34 def clip || scroll end |