Sha256: c13d3293690783569e334eef375112af73ae4d8bce1d2a634978371fcd8142d8

Contents?: true

Size: 596 Bytes

Versions: 4

Compression:

Stored size: 596 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?
      raise(Phenomenal::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.2.4 lib/phenomenal/relationship/requirement.rb
phenomenal-1.2.3 lib/phenomenal/relationship/requirement.rb
phenomenal-1.2.2 lib/phenomenal/relationship/requirement.rb
phenomenal-1.2.1 lib/phenomenal/relationship/requirement.rb