Class: Fop::Nodes::Text

Inherits:
Struct
  • Object
show all
Defined in:
lib/fop/nodes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#strObject

Returns the value of attribute str

Returns:

  • (Object)

    the current value of str



3
4
5
# File 'lib/fop/nodes.rb', line 3

def str
  @str
end

#wildcardObject

Returns the value of attribute wildcard

Returns:

  • (Object)

    the current value of wildcard



3
4
5
# File 'lib/fop/nodes.rb', line 3

def wildcard
  @wildcard
end

Instance Method Details

#consume!(input) ⇒ Object



4
5
6
7
# File 'lib/fop/nodes.rb', line 4

def consume!(input)
  @regex ||= Regexp.new((wildcard ? ".*" : "^") + Regexp.escape(str))
  input.slice!(@regex)
end

#to_sObject



9
10
11
12
# File 'lib/fop/nodes.rb', line 9

def to_s
  w = wildcard ? "*" : nil
  "Text #{w}#{str}"
end