class ClientForPoslynx::Data::AbstractData::AttributeElementMapping::Abstract

Attributes

attribute_name[R]
element_name[R]
numbered_line_template[R]

Public Class Methods

new(options) click to toggle source
# File lib/client_for_poslynx/data/abstract_data/attribute_element_mapping.rb, line 31
def initialize(options)
  options = options.reject { |k,v| v.nil? }
  @attribute_name = options.fetch( :attribute ) { raise ArgumentError, ':attribute option value must be provided' }
  @element_name   = options.fetch( :element   ) { raise ArgumentError, ':element option value must be provided' }
  options.delete :attribute ; options.delete :element
  additional_init options
  verify_no_unexpected_unused_options options
end

Public Instance Methods

multi_text?() click to toggle source
# File lib/client_for_poslynx/data/abstract_data/attribute_element_mapping.rb, line 29
def multi_text?     ; @multi_text     ; end
multi_text_mapping?() click to toggle source
# File lib/client_for_poslynx/data/abstract_data/attribute_element_mapping.rb, line 41
def multi_text_mapping?     ; false ; end
numbered_lines?() click to toggle source
# File lib/client_for_poslynx/data/abstract_data/attribute_element_mapping.rb, line 28
def numbered_lines? ; @numbered_lines ; end
numbered_lines_mapping?() click to toggle source
# File lib/client_for_poslynx/data/abstract_data/attribute_element_mapping.rb, line 42
def numbered_lines_mapping? ; false ; end
text_mapping?() click to toggle source
# File lib/client_for_poslynx/data/abstract_data/attribute_element_mapping.rb, line 40
def text_mapping?           ; false ; end
value_from_element_content(content) click to toggle source
# File lib/client_for_poslynx/data/abstract_data/attribute_element_mapping.rb, line 44
def value_from_element_content(content)
  raise NotImplementedError
  [].tap{ |lines|
    line_num = 1
    while ( content.has_key?(key =  numbered_line_template % line_num) )
      lines << content[key]
      line_num += 1
    end
  }
end
xml_doc_content_from_client_content(client_content) click to toggle source
# File lib/client_for_poslynx/data/abstract_data/attribute_element_mapping.rb, line 55
def xml_doc_content_from_client_content(client_content)
  raise NotImplementedError
end

Private Instance Methods

additional_init(options) click to toggle source
# File lib/client_for_poslynx/data/abstract_data/attribute_element_mapping.rb, line 68
def additional_init(options)
  # Do nothing by default.
end
verify_no_unexpected_unused_options(unused_options) click to toggle source
# File lib/client_for_poslynx/data/abstract_data/attribute_element_mapping.rb, line 61
def verify_no_unexpected_unused_options(unused_options)
  unless unused_options.empty?
    key_list = unused_options.keys.map(&:inspect)
    raise ArgumentError, "Unexpected option(s) #{key_list} supplied"
  end
end