Sha256: e1d9c4cc01d5d34356f09f2e05eea2e620702e54c197556de73a16a5eb6b6a0f

Contents?: true

Size: 913 Bytes

Versions: 2

Compression:

Stored size: 913 Bytes

Contents

# Jets::Builders::ShimVars::Shared.new(fun)
#
#   @deducer.functions.each do |function_name|
#     @deducer.handler_for(function_name)
#   end
#
# Implements:
#
#   functions: IE [:index, :show]
#   handler_for(function_name): IE handlers/controllers/posts_controller.index
#   js_path: IE: handlers/controllers/posts_controller.js
#
module Jets::Builders::ShimVars
  class Shared < Base
    # fun is a Jets::Stack::Function
    def initialize(fun)
      @fun = fun
    end

    # Always only one element for shared functions
    # functions: IE [:handle]
    def functions
      [@fun.meth] # function_names
    end

    # Dont need function_name arg but keeping the same interface as parent class
    # IE handlers/shared/functions/bob.handle
    def handler_for(function_name)
      @fun.handler_dest
    end

    # IE handlers/shared/functions/bob.js
    def js_path
      @fun.handler_dest
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jets-1.2.1 lib/jets/builders/shim_vars/shared.rb
jets-1.2.0 lib/jets/builders/shim_vars/shared.rb