Sha256: 42e9644557e3daacda047d43e6b13a271bf1a3fbc05765588af9c34e8f718c86

Contents?: true

Size: 760 Bytes

Versions: 14

Compression:

Stored size: 760 Bytes

Contents

module Chanko
  module Invoker
    class FunctionFinder
      def self.find(context, options)
        new(context, options).find
      end

      attr_reader :context, :options

      delegate :active_if_options, :as, :label, :unit_name, :to => :options

      def initialize(context, options)
        @context = context
        @options = options
      end

      def find
        active? && find_function
      end

      def scope
        as || context.class
      end

      def unit
        Loader.load(unit_name)
      end

      def find_function
        unit.find_function(scope, label)
      end

      def active?
        if unit
          unit.active?(context, active_if_options)
        else
          false
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
chanko-2.3.0 lib/chanko/invoker/function_finder.rb
chanko-2.2.1 lib/chanko/invoker/function_finder.rb
chanko-2.2.0 lib/chanko/invoker/function_finder.rb
chanko-2.1.1 lib/chanko/invoker/function_finder.rb
chanko-2.1.0 lib/chanko/invoker/function_finder.rb
chanko-2.0.8 lib/chanko/invoker/function_finder.rb
chanko-2.0.7 lib/chanko/invoker/function_finder.rb
chanko-2.0.6 lib/chanko/invoker/function_finder.rb
chanko-2.0.5 lib/chanko/invoker/function_finder.rb
chanko-2.0.4 lib/chanko/invoker/function_finder.rb
chanko-2.0.3 lib/chanko/invoker/function_finder.rb
chanko-2.0.2 lib/chanko/invoker/function_finder.rb
chanko-2.0.1 lib/chanko/invoker/function_finder.rb
chanko-2.0.0 lib/chanko/invoker/function_finder.rb