Class: HQ::Transform::RubyBackend::Session::Context
- Inherits:
-
Object
- Object
- HQ::Transform::RubyBackend::Session::Context
- Defined in:
- lib/hq/transform/ruby-backend.rb
Instance Attribute Summary collapse
-
#callback ⇒ Object
Returns the value of attribute callback.
-
#results ⇒ Object
Returns the value of attribute results.
Instance Method Summary collapse
- #find(type) ⇒ Object
-
#initialize ⇒ Context
constructor
A new instance of Context.
- #write(node) ⇒ Object
Constructor Details
#initialize ⇒ Context
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
#callback ⇒ Object
Returns the value of attribute callback.
48 49 50 |
# File 'lib/hq/transform/ruby-backend.rb', line 48 def callback @callback end |
#results ⇒ Object
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 |