Class: PMLCode::Content::Line

Inherits:
Object
  • Object
show all
Defined in:
lib/pmlcode/content.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, parts = [], highlighted = false) ⇒ Line

Returns a new instance of Line.



29
30
31
32
33
# File 'lib/pmlcode/content.rb', line 29

def initialize(text, parts = [], highlighted = false)
  @text = text
  @parts = parts
  @highlighted = highlighted
end

Instance Attribute Details

#textObject (readonly)

Returns the value of attribute text.



27
28
29
# File 'lib/pmlcode/content.rb', line 27

def text
  @text
end

Instance Method Details

#highlighted?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/pmlcode/content.rb', line 43

def highlighted?
  @highlighted
end

#in_part?(part = nil) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
38
39
40
41
# File 'lib/pmlcode/content.rb', line 35

def in_part?(part = nil)
  if part
    @parts.include?(part)
  else
    !@parts.empty?
  end
end