Sha256: d907de7a7a589bd2e075aa90a110aa7970f7f5bfc9658e6f8ecca33f28d06130

Contents?: true

Size: 324 Bytes

Versions: 47

Compression:

Stored size: 324 Bytes

Contents

module ViewModel
  class BaseViewModel
    def initialize(xml_doc)
      @xml_doc = xml_doc
    end

    def xpath(queries, node = @xml_doc)
      queries.each do |query|
        if node
          node = node.at query
        else
          return nil
        end
      end
      node ? node.content : nil
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
epb_view_models-1.0.6 lib/view_model/base_view_model.rb
epb_view_models-1.0.5 lib/view_model/base_view_model.rb
epb_view_models-1.0.4 lib/view_model/base_view_model.rb
epb_view_models-1.0.3 lib/view_model/base_view_model.rb
epb_view_models-1.0.2 lib/view_model/base_view_model.rb
epb_view_models-1.0.1 lib/view_model/base_view_model.rb
epb_view_models-1.0.0 lib/view_model/base_view_model.rb