Class: HQ::Transform::RubyBackend::Session::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/hq/transform/ruby-backend.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeContext

Returns a new instance of Context.



51
52
53
# File 'lib/hq/transform/ruby-backend.rb', line 51

def initialize
  @results = []
end

Instance Attribute Details

#callbackObject

Returns the value of attribute callback.



48
49
50
# File 'lib/hq/transform/ruby-backend.rb', line 48

def callback
  @callback
end

#resultsObject

Returns the value of attribute results.



49
50
51
# File 'lib/hq/transform/ruby-backend.rb', line 49

def results
  @results
end

Instance Method Details

#find(type) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/hq/transform/ruby-backend.rb', line 55

def find type

  strings =
    @callback.call \
      "search records",
      {
        "type" => type,
      }

  nodes =
    strings.map {
      |string|
      XML::Document.string(string).root
    }

  return nodes

end

#write(node) ⇒ Object



74
75
76
# File 'lib/hq/transform/ruby-backend.rb', line 74

def write node
  @results << node
end