Class: Mixpal::Event
- Inherits:
-
Object
- Object
- Mixpal::Event
- Defined in:
- lib/mixpal/event.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, properties) ⇒ Event
constructor
A new instance of Event.
- #render ⇒ Object
- #to_store ⇒ Object
Constructor Details
#initialize(name, properties) ⇒ Event
Returns a new instance of Event.
5 6 7 8 |
# File 'lib/mixpal/event.rb', line 5 def initialize(name, properties) @name = name @properties = properties end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/mixpal/event.rb', line 3 def name @name end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
3 4 5 |
# File 'lib/mixpal/event.rb', line 3 def properties @properties end |
Class Method Details
.from_store(data) ⇒ Object
22 23 24 |
# File 'lib/mixpal/event.rb', line 22 def self.from_store(data) new(data['name'], data['properties']) end |
Instance Method Details
#render ⇒ Object
10 11 12 13 |
# File 'lib/mixpal/event.rb', line 10 def render js_object = Mixpal::Util.hash_to_js_object_string(properties) "mixpanel.track(\"#{name}\", #{js_object});".html_safe end |
#to_store ⇒ Object
15 16 17 18 19 20 |
# File 'lib/mixpal/event.rb', line 15 def to_store { 'name' => name, 'properties' => properties } end |