Module: Sashite::Ggn
- Defined in:
- lib/sashite/ggn.rb,
lib/sashite/ggn/ruleset.rb,
lib/sashite/ggn/ruleset/source.rb,
lib/sashite/ggn/ruleset/source/destination.rb,
lib/sashite/ggn/ruleset/source/destination/engine.rb
Overview
General Gameplay Notation (GGN) implementation
GGN is a rule-agnostic format for describing pseudo-legal moves in abstract strategy board games.
Defined Under Namespace
Classes: Ruleset
Class Method Summary collapse
-
.parse(data) ⇒ Ruleset
Parse GGN data structure into an immutable Ruleset.
-
.valid?(data) ⇒ Boolean
Validate GGN data structure against specification.
Class Method Details
.parse(data) ⇒ Ruleset
Parse GGN data structure into an immutable Ruleset
36 37 38 |
# File 'lib/sashite/ggn.rb', line 36 def self.parse(data) Ruleset.new(data) end |
.valid?(data) ⇒ Boolean
Note:
Rescues both ArgumentError (invalid structure) and TypeError (wrong type)
Validate GGN data structure against specification
51 52 53 54 55 56 |
# File 'lib/sashite/ggn.rb', line 51 def self.valid?(data) parse(data) true rescue ::ArgumentError, ::TypeError false end |