Module: Krikri::MappingDSL::ParserMethods

Extended by:
ActiveSupport::Concern
Included in:
Krikri::MappingDSL
Defined in:
lib/krikri/mapping_dsl/parser_methods.rb

Overview

Implements methods for accessing parsed values in MappingDSL

Defined Under Namespace

Classes: RecordProxy

Instance Method Summary collapse

Instance Method Details

#headerProc

TODO:

consider a more generalized approach

Gives access to a delayed call for the `#header` of a parsed record.


50
51
52
53
54
55
56
# File 'lib/krikri/mapping_dsl/parser_methods.rb', line 50

def header
  lambda do |parsed|
    raise "#{parsed} does not have a `header`" unless
      parsed.respond_to? :header
    parsed.header
  end
end

#local_nameProc

Gives access to a delayed call for the `#local_name` of an OriginalRecord, to be executed at the time the mapping is processed.


24
25
26
27
28
# File 'lib/krikri/mapping_dsl/parser_methods.rb', line 24

def local_name
  lambda do |parsed|
    parsed.record.local_name
  end
end

#recordRecordProxy

Gives access to delayed method calls on parsed record ValueArrays, to be executed at the time the mapping is processed.

See Also:


14
15
16
# File 'lib/krikri/mapping_dsl/parser_methods.rb', line 14

def record
  RecordProxy.new
end

#record_uriProc

Gives access to a delayed call for the `#rdf_subject` of an OriginalRecord, to be executed at the time the mapping is processed.


36
37
38
39
40
41
42
# File 'lib/krikri/mapping_dsl/parser_methods.rb', line 36

def record_uri
  lambda do |parsed|
    raise "Tried to access subject URI for #{parsed.record}, " \
    "but it is not saved." unless parsed.record.exists?
    parsed.record.rdf_subject
  end
end