Class: GoodGuide::Gibbon::Context
- Inherits:
-
Object
- Object
- GoodGuide::Gibbon::Context
- Includes:
- Util
- Defined in:
- lib/goodguide/gibbon.rb
Instance Attribute Summary collapse
-
#gibbon ⇒ Object
readonly
Returns the value of attribute gibbon.
Instance Method Summary collapse
- #analyze(syntax, global_table, static_client) ⇒ Object
- #eval_gibbon(semantics, id, runtime_client) ⇒ Object
-
#initialize(js = {}) ⇒ Context
constructor
A new instance of Context.
- #parse(str) ⇒ Object
Methods included from Util
#hash_to_ruby, #obj_to_js, #obj_to_ruby
Constructor Details
Instance Attribute Details
#gibbon ⇒ Object (readonly)
Returns the value of attribute gibbon.
295 296 297 |
# File 'lib/goodguide/gibbon.rb', line 295 def gibbon @gibbon end |
Instance Method Details
#analyze(syntax, global_table, static_client) ⇒ Object
309 310 311 312 313 314 315 316 317 |
# File 'lib/goodguide/gibbon.rb', line 309 def analyze(syntax, global_table, static_client) syntax = obj_to_js(syntax) semantics, error = capture do |&callback| gibbon.analyze(syntax, global_table, static_client, callback) end [hash_to_ruby(semantics), obj_to_ruby(error)] end |
#eval_gibbon(semantics, id, runtime_client) ⇒ Object
319 320 321 322 323 324 325 326 |
# File 'lib/goodguide/gibbon.rb', line 319 def eval_gibbon(semantics, id, runtime_client) semantics = obj_to_js(semantics) values, error = capture do |&callback| gibbon.eval(semantics, 0, id, runtime_client, callback) end [hash_to_ruby(values), obj_to_ruby(error)] end |
#parse(str) ⇒ Object
305 306 307 |
# File 'lib/goodguide/gibbon.rb', line 305 def parse(str) obj_to_ruby self.gibbon.parse(str).asJSON end |