Sha256: 586c6b00b24583f9ea98c6ba3955b184ce5f45a51677ebbd06d14707ad47de48

Contents?: true

Size: 749 Bytes

Versions: 2

Compression:

Stored size: 749 Bytes

Contents

# File: customization.rb

require_relative 'constants'
require_relative 'hook-dsl'

module Cukedep # This module is used as a namespace
  class Customization
    # Retrieve before/after handlers from file
    # Handlers are put in a Hash with keys :before_hooks, :after_hooks.
    def build_handlers(directory)
      handlers = nil

      filepath = directory + '/' + Cukedep::HookFilename
      if File.exist? filepath
        obj = Object.new
        obj.extend(HookDSL)
        hook_source = File.read(filepath)
        obj.instance_eval(hook_source)
        handlers = {
          before_hooks: obj.before_hooks,
          after_hooks: obj.after_hooks
        }
      end

      return handlers
    end
  end # class
end # module

# End of file

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cukedep-0.2.01 lib/cukedep/customization.rb
cukedep-0.2.00 lib/cukedep/customization.rb