Sha256: 88ba4741157ce0079ccaca9384da12aba4b7225c13d91f81140c2fcbf915c27f

Contents?: true

Size: 606 Bytes

Versions: 4

Compression:

Stored size: 606 Bytes

Contents

# Define the behavior of the Requirement relationship
class Phenomenal::Requirement < Phenomenal::Relationship
  
  def activate_feature
    check_requirement
  end
  
  def deactivate_feature
  end
  
  def activate_context(context)
    if(source==context)
      check_requirement
    end
  end
  
  def deactivate_context(context)
    if(target==context)
      source.deactivate
    end
  end
  
  private
  def check_requirement
    if source.active? && !target.active?
      Phenomenal::Logger.instance.error(
        "Requirement of #{target} for #{source} is not satisfied"
      )
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
phenomenal-1.1.1 lib/phenomenal/relationships/requirement.rb
phenomenal-1.1.0 lib/phenomenal/relationships/requirement.rb
phenomenal-1.0.1 lib/phenomenal/relationships/requirement.rb
phenomenal-1.0.0 lib/phenomenal/relationships/requirement.rb