Sha256: 4d10f27b79a6c118f8c9520ed542eece1037d2ebde1b3c72fbac9856718f3432

Contents?: true

Size: 525 Bytes

Versions: 7

Compression:

Stored size: 525 Bytes

Contents

# frozen_string_literal: true

module Gifted
  module ViewHelpers
    def method_missing(method_name, *args, &block)
      view_context = Gifted::ViewContext.current
      view_context&.respond_to?(method_name) ? view_context.send(method_name, *args, &block) : super
    end

    def respond_to_missing?(method_name, *args)
      Gifted::ViewContext.current.respond_to?(method_name) || super
    end

    def controller
      @controller ||= Gifted::ViewContext.current.instance_variable_get(:@_controller)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gifted-1.3.0 lib/gifted/view_helpers.rb
gifted-1.2.0 lib/gifted/view_helpers.rb
gifted-1.1.1 lib/gifted/view_helpers.rb
gifted-1.1.0 lib/gifted/view_helpers.rb
gifted-1.0.0 lib/gifted/view_helpers.rb
gifted-0.2.1 lib/gifted/view_helpers.rb
gifted-0.2.0 lib/gifted/view_helpers.rb