Module: Botz::Connector::Html::Field

Included in:
DirectHtml, Botz::Connector::Html
Defined in:
lib/botz/connector/html.rb

Overview

field macro

Instance Method Summary collapse

Instance Method Details

#field(object, query, &block) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/botz/connector/html.rb', line 11

def field(object, query, &block)
  node = object.resource.search(query)
  fail "Could not be located #{query}" if node.nil?
  return node.first.text if block.nil?

  object.instance_exec(node, &block)
end