Module: AdHonorem::ObjectiveConcern

Extended by:
ActiveSupport::Concern
Included in:
Badge
Defined in:
lib/adhonorem/concerns/objective_concern.rb

Overview

Contains objective-related methods

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#objectivesObject (readonly)

Returns the value of attribute objectives.



6
7
8
# File 'lib/adhonorem/concerns/objective_concern.rb', line 6

def objectives
  @objectives
end

Instance Method Details

#add_objective(slug, name, description, amount_needed = 1) ⇒ Object



8
9
10
11
12
# File 'lib/adhonorem/concerns/objective_concern.rb', line 8

def add_objective(slug, name, description, amount_needed = 1)
  # prevent crash when Badges are initialized before migrations were applied
  return unless defined?(AdHonorem::Objective)
  @objectives[slug] = AdHonorem::Objective.new(slug, name, description, amount_needed)
end

#objectives_countObject



14
15
16
# File 'lib/adhonorem/concerns/objective_concern.rb', line 14

def objectives_count
  objectives.keys.count
end