Class: Reight::Navigator::Message
- Inherits:
-
Object
- Object
- Reight::Navigator::Message
- Defined in:
- lib/reight/app/navigator.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #flash(str, priority: 1) ⇒ Object
-
#initialize ⇒ Message
constructor
A new instance of Message.
- #sprite ⇒ Object
Constructor Details
#initialize ⇒ Message
Returns a new instance of Message.
133 134 135 |
# File 'lib/reight/app/navigator.rb', line 133 def initialize() @priority = 0 end |
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
137 138 139 |
# File 'lib/reight/app/navigator.rb', line 137 def text @text end |
Instance Method Details
#flash(str, priority: 1) ⇒ Object
139 140 141 142 143 144 145 |
# File 'lib/reight/app/navigator.rb', line 139 def flash(str, priority: 1) return if priority < @priority @text, @priority = str, priority set_timeout 2, id: :message_flash do @text, @priority = '', 0 end end |
#sprite ⇒ Object
147 148 149 150 151 152 153 154 155 156 |
# File 'lib/reight/app/navigator.rb', line 147 def sprite() @sprite ||= RubySketch::Sprite.new.tap do |sp| sp.draw do next unless @text fill 100 text_align LEFT, CENTER draw_text @text, 0, 0, sp.w, sp.h end end end |