Class: Socialoud::Services::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/socialoud/services.rb

Direct Known Subclasses

Facebook, Github, Gravatar, Linkedin, Twitter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, aggr = nil) ⇒ Base

Returns a new instance of Base.



6
7
8
9
# File 'lib/socialoud/services.rb', line 6

def initialize(data, aggr = nil)
  @data = data
  @aggregator = aggr
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/socialoud/services.rb', line 18

def method_missing(method, *args)
  if args.length > 0
    @data[method.to_s].send(args.shift, *args)
  else
    @data[method.to_s]
  end
end

Instance Attribute Details

#aggregatorObject (readonly)

Returns the value of attribute aggregator.



4
5
6
# File 'lib/socialoud/services.rb', line 4

def aggregator
  @aggregator
end

#dataObject (readonly)

Returns the value of attribute data.



4
5
6
# File 'lib/socialoud/services.rb', line 4

def data
  @data
end

Instance Method Details

#set(key, value) ⇒ Object



14
15
16
# File 'lib/socialoud/services.rb', line 14

def set(key, value)
  @data[key] = value
end

#setup!Object



11
12
# File 'lib/socialoud/services.rb', line 11

def setup!
end