Class: Lapis::Minecraft::Versioning::OSRule
- Defined in:
- lib/lapis/minecraft/versioning/os_rule.rb
Overview
Description of how resources can be chosen for operating systems.
Instance Attribute Summary collapse
-
#os_type ⇒ Symbol
readonly
Type of operating system this rule applies to.
-
#os_version ⇒ Regexp
readonly
Operating system version regex.
Attributes inherited from Rule
Instance Method Summary collapse
-
#==(other) ⇒ true, false
Compares one rule to another.
-
#initialize(is_allowed, os_type, os_version = nil) ⇒ OSRule
constructor
Creates an OS rule.
Constructor Details
#initialize(is_allowed, os_type, os_version = nil) ⇒ OSRule
Creates an OS rule.
25 26 27 28 29 |
# File 'lib/lapis/minecraft/versioning/os_rule.rb', line 25 def initialize(is_allowed, os_type, os_version = nil) super(is_allowed) @os_type = os_type @os_version = os_version ? Regexp.new(os_version) : // # Use empty regex if no version specified. end |
Instance Attribute Details
#os_type ⇒ Symbol (readonly)
Type of operating system this rule applies to.
12 13 14 |
# File 'lib/lapis/minecraft/versioning/os_rule.rb', line 12 def os_type @os_type end |
#os_version ⇒ Regexp (readonly)
Operating system version regex. This rule should apply if the OS version matches this regex.
17 18 19 |
# File 'lib/lapis/minecraft/versioning/os_rule.rb', line 17 def os_version @os_version end |
Instance Method Details
#==(other) ⇒ true, false
Compares one rule to another.
35 36 37 38 39 |
# File 'lib/lapis/minecraft/versioning/os_rule.rb', line 35 def ==(other) super(other) && other.os_type == @os_type && other.os_version == @os_version end |