module HOALife

:nodoc

Constants

VERSION

Public Class Methods

config() { |self| ... } click to toggle source

Support configuring with a block HOALife.config do |config|

config.api_key = "foo"

end HOALife.api_key

=> "foo"
# File lib/hoalife.rb, line 35
def config
  yield self
end
thread_local_var(key, default_value = nil) click to toggle source
# File lib/hoalife.rb, line 39
def thread_local_var(key, default_value = nil)
  current_key = "HOALIFE_RUBY_#{key}"

  Thread.current[current_key] = default_value

  define_singleton_method(key) do
    Thread.current[current_key]
  end

  define_singleton_method("#{key}=") do |value|
    Thread.current[current_key] = value
  end
end