Class: Minibidi::Realm
- Inherits:
-
Object
- Object
- Minibidi::Realm
- Defined in:
- lib/minibidi/realm.rb
Defined Under Namespace
Classes: ScriptEvaluationError
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(browsing_context:, id:, origin:, type: nil) ⇒ Realm
constructor
A new instance of Realm.
- #script_evaluate(expression) ⇒ Object
Constructor Details
#initialize(browsing_context:, id:, origin:, type: nil) ⇒ Realm
Returns a new instance of Realm.
3 4 5 6 7 8 |
# File 'lib/minibidi/realm.rb', line 3 def initialize(browsing_context:, id:, origin:, type: nil) @browsing_context = browsing_context @id = id @origin = origin @type = type end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
26 27 28 |
# File 'lib/minibidi/realm.rb', line 26 def type @type end |
Instance Method Details
#script_evaluate(expression) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/minibidi/realm.rb', line 12 def script_evaluate(expression) result = @browsing_context.send(:bidi_call_async, 'script.evaluate', { expression: expression, target: { realm: @id }, awaitPromise: true, }).wait if result[:type] == 'exception' raise ScriptEvaluationError.new(result[:exceptionDetails][:text]) end deserialize(result[:result]) end |