module Sistrix

Constants

SERVICE_HOST

Public Class Methods

config() { |instance| ... } click to toggle source
# File lib/sistrix/config.rb, line 9
def self.config
  if block_given?
    yield Config.instance
  end
  Config.instance
end
method_missing(sym, *args, &block) click to toggle source
# File lib/sistrix.rb, line 7
def self.method_missing(sym, *args, &block)
  clazz_name = 'Sistrix::' + sym.to_s.split(/_/).map { |w| w[0].upcase + w[1..w.length] }.join('::')
  lib_name   = 'sistrix/' + sym.to_s.gsub(/_/, '/')
  require lib_name

  clazz = class_from_string(clazz_name)
  return clazz.new(args[0]).call
end

Protected Class Methods

class_from_string(str) click to toggle source
# File lib/sistrix.rb, line 18
def self.class_from_string(str)
  str.split('::').inject(Object) do |mod, class_name|
    mod.const_get(class_name)
  end
end