Class: Style

Inherits:
Object
  • Object
show all
Defined in:
lib/yesroff/text.rb

Direct Known Subclasses

ParagraphStyle, TextStyle

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/yesroff/text.rb', line 3

def name
  @name
end

#parentObject

Returns the value of attribute parent.



3
4
5
# File 'lib/yesroff/text.rb', line 3

def parent
  @parent
end

Instance Method Details

#base_styleObject



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

Returns:

  • (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