Sha256: e6df9fea9fddcceb19bcaa47292fcdba22fca6dd8061c043d102fd3ccb19da98

Contents?: true

Size: 802 Bytes

Versions: 5

Compression:

Stored size: 802 Bytes

Contents

# Define the methods that can be called by a context to 
# define relationships
module Phenomenal::ContextRelationships
  def requires(context,*contexts)
    set_context_relationship(context,contexts) do |target|
      self.parent_feature.requirements_for(self,{:on=>target})
    end
  end
  
  def implies(context,*contexts)
    set_context_relationship(context,contexts) do |target|
      self.parent_feature.implications_for(self,{:on=>target})
    end
  end
  
  def suggests(context,*contexts)
    set_context_relationship(context,contexts) do |target|
      self.parent_feature.suggestions_for(self,{:on=>target})
    end
  end
  
  private
  def set_context_relationship(context,contexts)
    contexts = contexts.push(context)
    contexts.each do |target|
      yield(target)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
phenomenal-1.2.4 lib/phenomenal/relationship/context_relationships.rb
phenomenal-1.2.3 lib/phenomenal/relationship/context_relationships.rb
phenomenal-1.2.2 lib/phenomenal/relationship/context_relationships.rb
phenomenal-1.2.1 lib/phenomenal/relationship/context_relationships.rb
phenomenal-1.1.1 lib/phenomenal/relationships/context_relationships.rb