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
-
#header ⇒ Proc
Gives access to a delayed call for the ‘#header` of a parsed record.
-
#local_name ⇒ Proc
Gives access to a delayed call for the ‘#local_name` of an OriginalRecord, to be executed at the time the mapping is processed.
-
#record ⇒ RecordProxy
Gives access to delayed method calls on parsed record ValueArrays, to be executed at the time the mapping is processed.
-
#record_uri ⇒ Proc
Gives access to a delayed call for the ‘#rdf_subject` of an OriginalRecord, to be executed at the time the mapping is processed.
Instance Method Details
#header ⇒ Proc
consider a more generalized approach
Gives access to a delayed call for the ‘#header` of a parsed record.
50 51 52 53 54 55 |
# File 'lib/krikri/mapping_dsl/parser_methods.rb', line 50 def header RecordProxy.new( [{ name: :header }], Krikri::Parser::ValueArray, true) end |
#local_name ⇒ Proc
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 |
#record ⇒ RecordProxy
Gives access to delayed method calls on parsed record ValueArrays, to be executed at the time the mapping is processed.
14 15 16 |
# File 'lib/krikri/mapping_dsl/parser_methods.rb', line 14 def record RecordProxy.new end |
#record_uri ⇒ Proc
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 |