Module: Tap::Support
- Defined in:
- lib/tap/test/utils.rb,
lib/tap/support/gems.rb,
lib/tap/support/join.rb,
lib/tap/support/node.rb,
lib/tap/support/tdoc.rb,
lib/tap/support/audit.rb,
lib/tap/support/joins.rb,
lib/tap/support/intern.rb,
lib/tap/support/parser.rb,
lib/tap/support/schema.rb,
lib/tap/support/lazydoc.rb,
lib/tap/support/minimap.rb,
lib/tap/support/constant.rb,
lib/tap/support/manifest.rb,
lib/tap/support/versions.rb,
lib/tap/support/gems/rack.rb,
lib/tap/support/gems/rake.rb,
lib/tap/support/templater.rb,
lib/tap/support/aggregator.rb,
lib/tap/support/combinator.rb,
lib/tap/support/dependency.rb,
lib/tap/support/executable.rb,
lib/tap/support/joins/fork.rb,
lib/tap/support/string_ext.rb,
lib/tap/support/validation.rb,
lib/tap/support/assignments.rb,
lib/tap/support/joins/merge.rb,
lib/tap/support/shell_utils.rb,
lib/tap/support/configurable.rb,
lib/tap/support/dependencies.rb,
lib/tap/support/joins/switch.rb,
lib/tap/support/configuration.rb,
lib/tap/support/joins/sequence.rb,
lib/tap/support/lazydoc/config.rb,
lib/tap/support/lazydoc/method.rb,
lib/tap/support/lazydoc/comment.rb,
lib/tap/support/executable_queue.rb,
lib/tap/support/joins/sync_merge.rb,
lib/tap/support/lazydoc/document.rb,
lib/tap/support/constant_manifest.rb,
lib/tap/support/configurable_class.rb,
lib/tap/support/lazydoc/attributes.rb,
lib/tap/support/lazydoc/definition.rb,
lib/tap/support/class_configuration.rb,
lib/tap/support/instance_configuration.rb
Defined Under Namespace
Modules: Configurable, ConfigurableClass, Dependency, Executable, Gems, Joins, Lazydoc, Minimap, ShellUtils, StringExt, TDoc, Validation, Versions Classes: Aggregator, Assignments, Audit, AuditIterate, AuditMerge, ClassConfiguration, Combinator, Configuration, Constant, ConstantManifest, Dependencies, ExecutableQueue, InstanceConfiguration, Join, Manifest, Node, Parser, ReverseJoin, Schema, Templater
Constant Summary collapse
- INTERN_MODULES =
An array of already-declared intern modules, keyed by method_name.
{}
- Intern =
An Intern module for :process.
Support.Intern(:process)
Class Method Summary collapse
-
.Intern(method_name) ⇒ Object
Generates an Intern module for the specified method_name.
Class Method Details
.Intern(method_name) ⇒ Object
Generates an Intern module for the specified method_name. An Intern module:
-
adds an accessor for <method_name>_block
-
overrides <method_name> to call the block
-
ensures initialize_batch_obj extends the batch object with the same Intern module
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/tap/support/intern.rb', line 11 def self.Intern(method_name) mod = INTERN_MODULES[method_name.to_sym] return mod unless mod == nil mod = INTERN_MODULES[method_name.to_sym] = Module.new mod.module_eval %Q{ attr_accessor :#{method_name}_block def #{method_name}(*inputs) raise "no #{method_name} block set" unless #{method_name}_block inputs.unshift(self) arity = #{method_name}_block.arity n = inputs.length unless n == arity || (arity < 0 && (-1-n) <= arity) raise ArgumentError.new("wrong number of arguments (\#{n} for \#{arity})") end #{method_name}_block.call(*inputs) end def initialize_batch_obj(*args) super(*args).extend Tap::Support::Intern(:#{method_name}) end } mod end |