Class: Archimate::Export::Quad

Inherits:
Struct
  • Object
show all
Defined in:
lib/archimate/export/n_quads.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#objectObject

Returns the value of attribute object

Returns:

  • (Object)

    the current value of object



47
48
49
# File 'lib/archimate/export/n_quads.rb', line 47

def object
  @object
end

#predicateObject

Returns the value of attribute predicate

Returns:

  • (Object)

    the current value of predicate



47
48
49
# File 'lib/archimate/export/n_quads.rb', line 47

def predicate
  @predicate
end

#subjectObject

Returns the value of attribute subject

Returns:

  • (Object)

    the current value of subject



47
48
49
# File 'lib/archimate/export/n_quads.rb', line 47

def subject
  @subject
end

Instance Method Details

#fmt_objObject



48
49
50
51
52
53
54
# File 'lib/archimate/export/n_quads.rb', line 48

def fmt_obj
  if /\s/ === object
    "\"#{object.gsub('"', '\\"').gsub(/[\n\r]/, '\\n')}\""
  else
    "<#{object}>"
  end
end

#fmt_subjectObject



56
57
58
# File 'lib/archimate/export/n_quads.rb', line 56

def fmt_subject
  subject.gsub(/\s/, '_').to_s
end

#to_sObject



60
61
62
# File 'lib/archimate/export/n_quads.rb', line 60

def to_s
  "<#{fmt_subject}> <#{predicate}> #{fmt_obj} ."
end