Module: Sashite::Snn

Defined in:
lib/sashite/snn.rb,
lib/sashite/snn/name.rb

Overview

SNN (Style Name Notation) implementation for Ruby

Provides a formal naming system for identifying styles in abstract strategy board games. SNN uses canonical, human-readable ASCII names beginning with an uppercase letter. It supports unlimited unique style identifiers with consistent, rule-agnostic semantics.

Format: <uppercase-letter>[<lowercase-letter | digit>]*

Examples:

"Chess"       - Standard Western chess
"Shogi"       - Japanese chess
"Minishogi"   - 5

See: sashite.dev/specs/snn/1.0.0/

Defined Under Namespace

Classes: Name

Class Method Summary collapse

Class Method Details

.name(value) ⇒ Snn::Name

Create a new Name instance directly

Examples:

Sashite::Snn.name("Xiangqi") # => #<Snn::Name value="Xiangqi">

Parameters:

  • value (String, Symbol)

    style name to construct

Returns:

Raises:

  • (ArgumentError)

    if name format is invalid



55
56
57
# File 'lib/sashite/snn.rb', line 55

def self.name(value)
  Name.new(value)
end

.parse(snn_string) ⇒ Snn::Name

Parse an SNN string into a Name object

Examples:

Parse valid SNN names

Sashite::Snn.parse("Shogi")    # => #<Snn::Name value="Shogi">

Parameters:

  • snn_string (String)

    the name string

Returns:

Raises:

  • (ArgumentError)

    if the name is invalid



43
44
45
# File 'lib/sashite/snn.rb', line 43

def self.parse(snn_string)
  Name.parse(snn_string)
end

.valid?(snn_string) ⇒ Boolean

Check if a string is valid SNN notation

Examples:

Validate SNN strings

Sashite::Snn.valid?("Chess")     # => true
Sashite::Snn.valid?("minishogi") # => false
Sashite::Snn.valid?("Go9x9")     # => true

Parameters:

  • snn_string (String)

    the string to validate

Returns:

  • (Boolean)

    true if valid SNN, false otherwise



31
32
33
# File 'lib/sashite/snn.rb', line 31

def self.valid?(snn_string)
  Name.valid?(snn_string)
end