Class: RubyCurses::ModStack::Item
- Defined in:
- lib/canis/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.
265 266 267 268 269 270 271 272 273 274 275 |
# File 'lib/canis/core/util/basestack.rb', line 265 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
289 290 291 |
# File 'lib/canis/core/util/basestack.rb', line 289 def method_missing(sym, *args, &block) @widget.send sym, *args, &block end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
263 264 265 |
# File 'lib/canis/core/util/basestack.rb', line 263 def config @config end |
#margin_bottom ⇒ Object (readonly)
Returns the value of attribute margin_bottom.
264 265 266 |
# File 'lib/canis/core/util/basestack.rb', line 264 def margin_bottom @margin_bottom end |
#margin_left ⇒ Object (readonly)
Returns the value of attribute margin_left.
264 265 266 |
# File 'lib/canis/core/util/basestack.rb', line 264 def margin_left @margin_left end |
#margin_right ⇒ Object (readonly)
Returns the value of attribute margin_right.
264 265 266 |
# File 'lib/canis/core/util/basestack.rb', line 264 def margin_right @margin_right end |
#margin_top ⇒ Object (readonly)
Returns the value of attribute margin_top.
264 265 266 |
# File 'lib/canis/core/util/basestack.rb', line 264 def margin_top @margin_top end |
#widget ⇒ Object (readonly)
Returns the value of attribute widget.
263 264 265 |
# File 'lib/canis/core/util/basestack.rb', line 263 def @widget end |
Instance Method Details
#repaint ⇒ Object
278 |
# File 'lib/canis/core/util/basestack.rb', line 278 def repaint; @widget.repaint; end |
#weight ⇒ Object
276 |
# File 'lib/canis/core/util/basestack.rb', line 276 def weight; @config[:weight]||100; end |
#weight=(val) ⇒ Object
277 |
# File 'lib/canis/core/util/basestack.rb', line 277 def weight=(val); @config[:weight]=val; end |