Class: RubyCurses::ModStack::Item
- Defined in:
- lib/rbcurse/core/util/basestack.rb
Overview
A wrapper over widget mostly because it adds weight and margins
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#margin_bottom ⇒ Object
readonly
Returns the value of attribute margin_bottom.
-
#margin_left ⇒ Object
readonly
Returns the value of attribute margin_left.
-
#margin_right ⇒ Object
readonly
Returns the value of attribute margin_right.
-
#margin_top ⇒ Object
readonly
Returns the value of attribute margin_top.
-
#widget ⇒ Object
readonly
Returns the value of attribute widget.
Instance Method Summary collapse
-
#initialize(config = {}, widget) ⇒ Item
constructor
A new instance of Item.
- #method_missing(sym, *args, &block) ⇒ Object
- #repaint ⇒ Object
- #weight ⇒ Object
- #weight=(val) ⇒ Object
Constructor Details
#initialize(config = {}, widget) ⇒ Item
Returns a new instance of Item.
259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/rbcurse/core/util/basestack.rb', line 259 def initialize config={}, @config = config config.each do |k, v| instance_variable_set "@#{k}", v end @margin_left ||= 0 @margin_right ||= 0 @margin_top ||= 0 @margin_bottom ||= 0 @widget = end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
283 284 285 |
# File 'lib/rbcurse/core/util/basestack.rb', line 283 def method_missing(sym, *args, &block) @widget.send sym, *args, &block end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
257 258 259 |
# File 'lib/rbcurse/core/util/basestack.rb', line 257 def config @config end |
#margin_bottom ⇒ Object (readonly)
Returns the value of attribute margin_bottom.
258 259 260 |
# File 'lib/rbcurse/core/util/basestack.rb', line 258 def margin_bottom @margin_bottom end |
#margin_left ⇒ Object (readonly)
Returns the value of attribute margin_left.
258 259 260 |
# File 'lib/rbcurse/core/util/basestack.rb', line 258 def margin_left @margin_left end |
#margin_right ⇒ Object (readonly)
Returns the value of attribute margin_right.
258 259 260 |
# File 'lib/rbcurse/core/util/basestack.rb', line 258 def margin_right @margin_right end |
#margin_top ⇒ Object (readonly)
Returns the value of attribute margin_top.
258 259 260 |
# File 'lib/rbcurse/core/util/basestack.rb', line 258 def margin_top @margin_top end |
#widget ⇒ Object (readonly)
Returns the value of attribute widget.
257 258 259 |
# File 'lib/rbcurse/core/util/basestack.rb', line 257 def @widget end |
Instance Method Details
#repaint ⇒ Object
272 |
# File 'lib/rbcurse/core/util/basestack.rb', line 272 def repaint; @widget.repaint; end |
#weight ⇒ Object
270 |
# File 'lib/rbcurse/core/util/basestack.rb', line 270 def weight; @config[:weight]||100; end |
#weight=(val) ⇒ Object
271 |
# File 'lib/rbcurse/core/util/basestack.rb', line 271 def weight=(val); @config[:weight]=val; end |