Class: Shoes::Text

Inherits:
Object
  • Object
show all
Includes:
Common::Inspect, Common::LinkFinder
Defined in:
shoes-core/lib/shoes/text.rb

Direct Known Subclasses

Span

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Common::LinkFinder

#find_links

Methods included from Common::Inspect

#inspect

Constructor Details

#initialize(texts, color = nil) ⇒ Text

Returns a new instance of Text.



11
12
13
14
15
16
17
# File 'shoes-core/lib/shoes/text.rb', line 11

def initialize(texts, color = nil)
  @texts      = texts
  @color      = color
  @to_s       = @texts.map(&:to_s).join
  @parent     = nil
  @text_block = nil
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



8
9
10
# File 'shoes-core/lib/shoes/text.rb', line 8

def color
  @color
end

#parentObject

Returns the value of attribute parent.



9
10
11
# File 'shoes-core/lib/shoes/text.rb', line 9

def parent
  @parent
end

#text_blockObject

Returns the value of attribute text_block.



9
10
11
# File 'shoes-core/lib/shoes/text.rb', line 9

def text_block
  @text_block
end

#textsObject (readonly)

Returns the value of attribute texts.



8
9
10
# File 'shoes-core/lib/shoes/text.rb', line 8

def texts
  @texts
end

#to_sObject (readonly)

Returns the value of attribute to_s.



8
9
10
# File 'shoes-core/lib/shoes/text.rb', line 8

def to_s
  @to_s
end

Instance Method Details

#appObject



19
20
21
# File 'shoes-core/lib/shoes/text.rb', line 19

def app
  parent&.app
end


23
24
25
# File 'shoes-core/lib/shoes/text.rb', line 23

def links
  find_links(@texts)
end