class Loom::Shell::Api

A facade for the shell API exposed to Loom files. This is the loom object passed to patterns.

Public Class Methods

new(shell) click to toggle source
# File lib/loom/shell/api.rb, line 8
def initialize(shell)
  @shell = shell
  @mod_loader = shell.mod_loader
  @dry_run = shell.dry_run
end

Public Instance Methods

dry_run?() click to toggle source
# File lib/loom/shell/api.rb, line 14
def dry_run?
  @dry_run
end
local() click to toggle source
# File lib/loom/shell/api.rb, line 18
def local
  @shell.local.shell_api
end
method_missing(name, *args, &block) click to toggle source

This is the entry point for `loom.foo` calls from .loom files.

# File lib/loom/shell/api.rb, line 23
def method_missing(name, *args, &block)
  Loom.log.debug3(self) { "shell api => #{name} #{args} #{block}" }
  # TODO: The relationship between shell and mod_loader seems leaky here, a
  # Shell::Api should have a shell and not care about the mod_loader,
  # currently it seems to violate Demeter. The shell should dispatch to the
  # mod_loader only as an implementation detail. Otherwise this is harder to
  # test.
  @mod_loader.send name, @shell, *args, &block
end