Module: Hatt::Mixin

Includes:
ApiClients, Configuration, DSL, Log
Included in:
Hatt, SingletonMixin::InitOnceHattClass
Defined in:
lib/hatt/mixin.rb

Constant Summary

Constants included from Log

Log::HattFormatter

Constants included from Configuration

Configuration::DEFAULT_CONFIG_FILE, Configuration::DEFAULT_HATT_GLOBS

Instance Method Summary collapse

Methods included from DSL

#hatt_load_hatt_file, #hatt_load_hatt_glob, #load_hatts_using_configuration

Methods included from Log

#add_logger, #level=, #log, #logger, #loggers

Methods included from Configuration

#hatt_config_file=, #hatt_configuration

Methods included from ApiClients

#hatt_add_service, #hatt_build_client_methods

Instance Method Details

#hatt_initializeObject



13
14
15
16
17
# File 'lib/hatt/mixin.rb', line 13

def hatt_initialize
  hatt_build_client_methods
  load_hatts_using_configuration
  self
end

#launch_pry_replObject



29
30
31
# File 'lib/hatt/mixin.rb', line 29

def launch_pry_repl
  require 'pry';binding.pry
end

#run_script_file(filename) ⇒ Object

Raises:

  • (ArgumentError)


19
20
21
22
23
24
25
26
27
# File 'lib/hatt/mixin.rb', line 19

def run_script_file(filename)
  info "Running data script '#{filename}'"
  raise(ArgumentError, "No such file '#{filename}'") unless File.exist? filename
  # by running in a anonymous class, we protect this class's namespace
  anon_class = BlankSlateProxy.new(self)
  with_local_load_path File.dirname(filename) do
    anon_class.instance_eval(IO.read(filename), filename, 1)
  end
end