Class: AhoyCaptain::Goal

Inherits:
Object
  • Object
show all
Defined in:
lib/ahoy_captain/goals.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGoal

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_queryObject (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

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/ahoy_captain/goals.rb', line 3

def id
  @id
end

#titleObject (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