Class: Style
- Inherits:
-
Object
- Object
- Style
- Defined in:
- lib/yesroff/text.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
- #base_style ⇒ Object
- #child_of?(name) ⇒ Boolean
-
#initialize(name, parent = nil) ⇒ Style
constructor
A new instance of Style.
Constructor Details
#initialize(name, parent = nil) ⇒ Style
Returns a new instance of Style.
6 7 8 9 |
# File 'lib/yesroff/text.rb', line 6 def initialize(name, parent = nil) @name = name @parent = parent end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/yesroff/text.rb', line 3 def name @name end |
#parent ⇒ Object
Returns the value of attribute parent.
3 4 5 |
# File 'lib/yesroff/text.rb', line 3 def parent @parent end |
Instance Method Details
#base_style ⇒ Object
17 18 19 20 |
# File 'lib/yesroff/text.rb', line 17 def base_style return self unless @parent @parent.base_style end |
#child_of?(name) ⇒ Boolean
11 12 13 14 15 |
# File 'lib/yesroff/text.rb', line 11 def child_of?(name) return true if name == @name return false unless @parent @parent.child_of?(name) end |