Class: Amplitude::Event
- Inherits:
-
Object
show all
- Defined in:
- lib/amplitude/event.rb
Instance Method Summary
collapse
Constructor Details
#initialize(data) ⇒ Event
Returns a new instance of Event.
4
5
6
|
# File 'lib/amplitude/event.rb', line 4
def initialize(data)
@data = Amplitude::Formatter.call(data)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
16
17
18
19
|
# File 'lib/amplitude/event.rb', line 16
def method_missing(method, *args)
return @data[method] if @data.key?(method)
super
end
|
Instance Method Details
#as_json ⇒ Object
8
9
10
|
# File 'lib/amplitude/event.rb', line 8
def as_json
@data.dup
end
|
#respond_to_missing?(method, include_all = false) ⇒ Boolean
21
22
23
24
|
# File 'lib/amplitude/event.rb', line 21
def respond_to_missing?(method, include_all = false)
return true if @data.key?(method)
super
end
|
#to_json ⇒ Object
12
13
14
|
# File 'lib/amplitude/event.rb', line 12
def to_json
MultiJson.dump(@data)
end
|