Class: AhoyCaptain::Goal
- Inherits:
-
Object
- Object
- AhoyCaptain::Goal
- Defined in:
- lib/ahoy_captain/goals.rb
Instance Attribute Summary collapse
-
#event_query ⇒ Object
readonly
Returns the value of attribute event_query.
-
#id ⇒ Object
Returns the value of attribute id.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #event(value) ⇒ Object
-
#initialize ⇒ Goal
constructor
A new instance of Goal.
- #label(value) ⇒ Object
- #name(value) ⇒ Object
- #query(&block) ⇒ Object
Constructor Details
#initialize ⇒ Goal
Returns a new instance of Goal.
5 6 7 8 9 |
# File 'lib/ahoy_captain/goals.rb', line 5 def initialize @id = nil @title = nil @event_query = nil end |
Instance Attribute Details
#event_query ⇒ Object (readonly)
Returns the value of attribute event_query.
4 5 6 |
# File 'lib/ahoy_captain/goals.rb', line 4 def event_query @event_query end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/ahoy_captain/goals.rb', line 3 def id @id end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'lib/ahoy_captain/goals.rb', line 4 def title @title end |
Instance Method Details
#event(value) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/ahoy_captain/goals.rb', line 19 def event(value) ActiveSupport::Deprecation.warn( "event is deprecated. " \ "Use name instead." ) name(value) end |
#label(value) ⇒ Object
11 12 13 |
# File 'lib/ahoy_captain/goals.rb', line 11 def label(value) @title = value end |
#name(value) ⇒ Object
15 16 17 |
# File 'lib/ahoy_captain/goals.rb', line 15 def name(value) @event_query = -> { ::AhoyCaptain.event.where(name: value) } end |
#query(&block) ⇒ Object
27 28 29 |
# File 'lib/ahoy_captain/goals.rb', line 27 def query(&block) @event_query = block end |