Sha256: d37aeae4291e0773ae80058d58ba458903c6d8bdb7e252823935a15239d606f4
Contents?: true
Size: 860 Bytes
Versions: 6
Compression:
Stored size: 860 Bytes
Contents
require 'ostruct' module Spectre module Mixin class << self @@mixins = {} def mixin desc, &block @@mixins[desc] = block end def run desc, with: [] raise "no mixin with desc '#{desc}' defined" unless @@mixins.key? desc Logger.log_debug "running mixin '#{desc}'" if with.is_a? Array @@mixins[desc].call *with else @@mixins[desc].call with end end alias_method :also, :run alias_method :step, :run end Spectre.register do |config| if not config.key? 'mixin_patterns' return end config['mixin_patterns'].each do |pattern| Dir.glob(pattern).each do|f| require_relative File.join(Dir.pwd, f) end end end Spectre.delegate :mixin, :run, :also, :step, to: Mixin end end
Version data entries
6 entries across 6 versions & 1 rubygems