module Charmkit::Base

Public Instance Methods

deps() click to toggle source

Access deps class

# File lib/charmkit/hook.rb, line 29
def deps
  Dependencies
end
use(name, options = {}) click to toggle source

Include scrolls to be used within hook execution

Note: Idea lifted from github.com/mckomo/metaxa @param [Symbol] name symbol of scroll @param [Hash] options (NotImplemented) Options to be passed to scroll @example

use :nginx
nginx.add_host server: "test.com"
# File lib/charmkit/hook.rb, line 13
def use(name, options = {})
  require "charmkit/scrolls/#{name.to_s}"
  name_ref = name
  if options[:alias]
    name_ref = options[:alias]
  end

  var_module = Module.new do
    attr_accessor name_ref.to_sym
  end
  extend var_module
  set(name_ref, to_const(name.to_s).new)
end

Private Instance Methods

get(variable) click to toggle source
# File lib/charmkit/hook.rb, line 34
def get(variable)
  instance_variable_get("@#{variable}")
end
set(variable, value) click to toggle source
# File lib/charmkit/hook.rb, line 38
def set(variable, value)
  instance_variable_set("@#{variable}", value)
end
to_const(name) click to toggle source
# File lib/charmkit/hook.rb, line 42
def to_const(name)
  klass = name.classify
  klass.constantize
end