Class: Rubyang::Xpath::Literal

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyang/xpath.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Literal

Returns a new instance of Literal.



407
408
409
410
411
412
413
414
415
416
# File 'lib/rubyang/xpath.rb', line 407

def initialize value
  @value = case value
           when /^"(?:[^"])*"/
             value.gsub(/^"/,'').gsub(/"$/,'').gsub(/\\n/,"\n").gsub(/\\t/,"\t").gsub(/\\"/,"\"").gsub(/\\\\/,"\\")
           when /^'(?:[^'])*'/
             value.gsub(/^'/,'').gsub(/'$/,'')
           else
             value
           end
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



406
407
408
# File 'lib/rubyang/xpath.rb', line 406

def value
  @value
end