Module: Missions::DSL::Helpers::ClassMethods

Defined in:
lib/missions/dsl/helpers.rb

Instance Method Summary collapse

Instance Method Details

#dsl_categoriesObject

List of mission callbacks mapped to default DSL categories


35
36
37
38
39
40
41
# File 'lib/missions/dsl/helpers.rb', line 35

def dsl_categories
  @dsl_categories ||= {:requirements         => Missions::DSL::Requirements,
                       :assignment_callbacks => Missions::DSL::Assignment,
                       :victory_conditions   => Missions::DSL::Query,
                       :victory_callbacks    => Missions::DSL::Resolution,
                       :failure_callbacks    => Missions::DSL::Resolution}
end

#dsl_category_for(cb_type) ⇒ Object

Return DSL category from name or configured for mission callback


44
45
46
# File 'lib/missions/dsl/helpers.rb', line 44

def dsl_category_for(cb_type)
  dsl_categories[cb_type]
end

#has_dsl_method?(dsl_method) ⇒ Boolean

Return bool if dsl module has specified method


30
31
32
# File 'lib/missions/dsl/helpers.rb', line 30

def has_dsl_method?(dsl_method)
  self.methods.collect { |m| m.to_s }.include?(dsl_method.to_s)
end

#nodeObject

Provide access to centralized node


25
26
27
# File 'lib/missions/dsl/helpers.rb', line 25

def node
  Missions::RJR.node
end

#registryObject

Provide access to centralized registry


20
21
22
# File 'lib/missions/dsl/helpers.rb', line 20

def registry
  Missions::RJR.registry
end

#update_mission(mission) ⇒ Object

Update registry mission


15
16
17
# File 'lib/missions/dsl/helpers.rb', line 15

def update_mission(mission)
  Missions::RJR.registry.update(mission) { |m| m.id == mission.id }
end