Module: Jet::Core

Defined in:
lib/jet/core.rb,
lib/jet/core/version.rb,
lib/jet/core/instance_registry.rb

Defined Under Namespace

Modules: InstanceRegistry

Constant Summary collapse

MAJOR =
0
MINOR =
1
TINY =
0
VERSION =
[MAJOR, MINOR, TINY].join(".").freeze

Class Method Summary collapse

Class Method Details

.block_and_callables!(*callables, &blk) ⇒ Object

Raises:

  • (ArgumentError)


72
73
74
75
76
77
# File 'lib/jet/core.rb', line 72

def block_and_callables!(*callables, &blk)
  raise ArgumentError, "`callables` must respond to `call`" unless
    callables.all? { |obj| obj.respond_to?(:call) }

  ([blk] + callables).compact
end

.block_or_callable!(callable, &blk) ⇒ Object

Raises:

  • (ArgumentError)


79
80
81
82
83
84
85
# File 'lib/jet/core.rb', line 79

def block_or_callable!(callable, &blk)
  raise ArgumentError, "both block and callable given" if blk && callable
  raise ArgumentError, "`callable` must respond to `call`" if
    callable && !callable.respond_to?(:call)

  blk || callable
end

.versionObject



10
11
12
# File 'lib/jet/core/version.rb', line 10

def self.version
  VERSION
end