Class: Shoes::Text
Direct Known Subclasses
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#str ⇒ Object
readonly
Returns the value of attribute str.
-
#style ⇒ Object
readonly
Returns the value of attribute style.
-
#to_s ⇒ Object
readonly
Returns the value of attribute to_s.
Instance Method Summary collapse
-
#initialize(m, str, color = nil) ⇒ Text
constructor
A new instance of Text.
- #replace(*str) ⇒ Object
Constructor Details
#initialize(m, str, color = nil) ⇒ Text
Returns a new instance of Text.
26 27 28 29 |
# File 'lib/shoes/text.rb', line 26 def initialize m, str, color=nil @style, @str, @color = m, str, color @to_s = str.map(&:to_s).join end |
Instance Attribute Details
#color ⇒ Object (readonly)
Returns the value of attribute color.
30 31 32 |
# File 'lib/shoes/text.rb', line 30 def color @color end |
#parent ⇒ Object
Returns the value of attribute parent.
31 32 33 |
# File 'lib/shoes/text.rb', line 31 def parent @parent end |
#str ⇒ Object (readonly)
Returns the value of attribute str.
30 31 32 |
# File 'lib/shoes/text.rb', line 30 def str @str end |
#style ⇒ Object (readonly)
Returns the value of attribute style.
30 31 32 |
# File 'lib/shoes/text.rb', line 30 def style @style end |
#to_s ⇒ Object (readonly)
Returns the value of attribute to_s.
30 31 32 |
# File 'lib/shoes/text.rb', line 30 def to_s @to_s end |
Instance Method Details
#replace(*str) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/shoes/text.rb', line 33 def replace *str @str = str @to_s = str.map(&:to_s).join @parent.args[:markup] = @parent.markup = @parent.contents.map(&:to_s).join @parent.args[:styles] = @parent.styles = @parent.app.get_styles @parent.contents @parent.style markup: @parent.markup end |