Module: HOALife

Defined in:
lib/hoalife.rb,
lib/hoalife/error.rb,
lib/hoalife/version.rb

Overview

:nodoc

Defined Under Namespace

Modules: Arrayable, Concern Classes: Account, BadRequestError, CCRArticle, CCRViolationType, Error, Escalation, ForbiddenError, HTTPError, Inspection, NotFoundError, Property, RateLimitError, Resource, SigningMissmatchError, UnauthorizedError, UndefinedResourceError, UploadUrl, User, Violation

Constant Summary collapse

VERSION =
'0.1.8'

Class Method Summary collapse

Class Method Details

.config {|_self| ... } ⇒ Object

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

config.api_key = "foo"

end HOALife.api_key

=> "foo"

Yields:

  • (_self)

Yield Parameters:

  • _self (HOALife)

    the object that the method was called on



36
37
38
# File 'lib/hoalife.rb', line 36

def config
  yield self
end

.thread_local_var(key, default_value = nil) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/hoalife.rb', line 40

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