Module: Topsy::Configurable

Included in:
Topsy, Client
Defined in:
lib/topsy/configurable.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_key=(value) ⇒ Object (writeonly)

Sets the attribute api_key

Parameters:

  • value

    the value to set the attribute api_key to.



4
5
6
# File 'lib/topsy/configurable.rb', line 4

def api_key=(value)
  @api_key = value
end

Class Method Details

.keysObject



8
9
10
11
12
# File 'lib/topsy/configurable.rb', line 8

def keys
  @keys ||= [
    :api_key
  ]
end

Instance Method Details

#cache_keyFixnum

Returns:

  • (Fixnum)


23
24
25
# File 'lib/topsy/configurable.rb', line 23

def cache_key
  options.hash
end

#configure {|_self| ... } ⇒ Object

Convenience method to allow configuration options to be set in a block

Yields:

  • (_self)

Yield Parameters:



17
18
19
20
# File 'lib/topsy/configurable.rb', line 17

def configure
  yield self
  self
end

#reset!Object Also known as: setup



27
28
29
30
31
32
# File 'lib/topsy/configurable.rb', line 27

def reset!
  Topsy::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", Topsy::Default.options[key])
  end
  self
end