Class: When::Parts::Resource::ContentLine

Inherits:
Object
  • Object
show all
Defined in:
lib/when_exe/parts/resource.rb

Constant Summary collapse

RFC6350 =
{
  "\\\\" => "\\",
  "\\n"  => "\n",
  "\\N"  => "\n",
  "\\;"  => ";",
  "\\:"  => ":"
}
RFC6868 =
{
  "^n"  => "\n",
  "^^"  => "^",
  "^'"  => '"'
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, object = nil, marked = nil) ⇒ ContentLine

Returns a new instance of ContentLine.



64
65
66
67
68
69
70
71
# File 'lib/when_exe/parts/resource.rb', line 64

def initialize(key, object=nil, marked=nil)
  key = key.downcase.gsub(/-/,'_') if (key==key.upcase)
  @predicate, @namespace = key.split(/:/).reverse
  object     = object.gsub(/\^./) {|escape| RFC6868[escape] || escape} if object.instance_of?(String)
  @object    = object
  @marked    = marked
  @attribute = {}
end

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



59
60
61
# File 'lib/when_exe/parts/resource.rb', line 59

def attribute
  @attribute
end

#markedObject (readonly)

Returns the value of attribute marked.



62
63
64
# File 'lib/when_exe/parts/resource.rb', line 62

def marked
  @marked
end

#namespaceObject

Returns the value of attribute namespace.



60
61
62
# File 'lib/when_exe/parts/resource.rb', line 60

def namespace
  @namespace
end

#objectObject

Returns the value of attribute object.



58
59
60
# File 'lib/when_exe/parts/resource.rb', line 58

def object
  @object
end

#predicateObject (readonly)

Returns the value of attribute predicate.



57
58
59
# File 'lib/when_exe/parts/resource.rb', line 57

def predicate
  @predicate
end

#same_altidObject

Returns the value of attribute same_altid.



61
62
63
# File 'lib/when_exe/parts/resource.rb', line 61

def same_altid
  @same_altid
end