Class: GObjectIntrospection::Loader::Invoker
- Inherits:
-
Object
- Object
- GObjectIntrospection::Loader::Invoker
- Defined in:
- lib/gobject-introspection/loader.rb
Instance Method Summary collapse
-
#initialize(info, method_name, full_method_name) ⇒ Invoker
constructor
A new instance of Invoker.
- #invoke(receiver, arguments, block) ⇒ Object
Constructor Details
#initialize(info, method_name, full_method_name) ⇒ Invoker
Returns a new instance of Invoker.
587 588 589 590 591 592 |
# File 'lib/gobject-introspection/loader.rb', line 587 def initialize(info, method_name, full_method_name) @info = info @method_name = method_name @full_method_name = full_method_name @prepared = false end |
Instance Method Details
#invoke(receiver, arguments, block) ⇒ Object
594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 |
# File 'lib/gobject-introspection/loader.rb', line 594 def invoke(receiver, arguments, block) ensure_prepared if receiver and @function_info_p arguments.unshift(receiver) end arguments, block = build(receiver, arguments, block) unless valid?(arguments) if @on_invalid == :fallback return @value_on_invalid else raise ArgumentError, (invoke_arguments) end end if block.nil? and @require_callback_p receiver.to_enum(@method_name, *arguments) else if @function_info_p return_value = @info.invoke(arguments, &block) else return_value = @info.invoke(receiver, arguments, &block) end if @have_return_value_p return_value else receiver end end end |