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.



45
46
47
48
49
50
51
52
# File 'lib/when_exe/parts/resource.rb', line 45

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.



40
41
42
# File 'lib/when_exe/parts/resource.rb', line 40

def attribute
  @attribute
end

#markedObject (readonly)

Returns the value of attribute marked.



43
44
45
# File 'lib/when_exe/parts/resource.rb', line 43

def marked
  @marked
end

#namespaceObject

Returns the value of attribute namespace.



41
42
43
# File 'lib/when_exe/parts/resource.rb', line 41

def namespace
  @namespace
end

#objectObject

Returns the value of attribute object.



39
40
41
# File 'lib/when_exe/parts/resource.rb', line 39

def object
  @object
end

#predicateObject (readonly)

Returns the value of attribute predicate.



38
39
40
# File 'lib/when_exe/parts/resource.rb', line 38

def predicate
  @predicate
end

#same_altidObject

Returns the value of attribute same_altid.



42
43
44
# File 'lib/when_exe/parts/resource.rb', line 42

def same_altid
  @same_altid
end