Class: Lapis::Minecraft::Versioning::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/lapis/minecraft/versioning/rule.rb

Overview

Description of how resources can be chosen.

Direct Known Subclasses

OSRule

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(is_allowed) ⇒ Rule

Creates a basic rule.


16
17
18
# File 'lib/lapis/minecraft/versioning/rule.rb', line 16

def initialize(is_allowed)
  @is_allowed = !!is_allowed
end

Instance Attribute Details

#allowed?Boolean (readonly)

Indicates whether the resource should be included.


10
11
12
# File 'lib/lapis/minecraft/versioning/rule.rb', line 10

def allowed?
  @is_allowed
end

Instance Method Details

#==(other) ⇒ true, false

Compares one rule to another.


33
34
35
# File 'lib/lapis/minecraft/versioning/rule.rb', line 33

def ==(other)
  other.allowed? == @is_allowed
end

#applies_to?(_properties) ⇒ true, false

Note:

Base rules always apply.

Checks whether the rule applies to a set of properties.


25
26
27
# File 'lib/lapis/minecraft/versioning/rule.rb', line 25

def applies_to?(_properties)
  true
end