Module: StateGate

Defined in:
lib/state_gate.rb,
lib/state_gate/type.rb,
lib/state_gate/engine.rb,
lib/state_gate/builder.rb,
lib/state_gate/version.rb,
lib/state_gate/assertions.rb,
lib/state_gate/engine/fixer.rb,
lib/state_gate/engine/scoper.rb,
lib/state_gate/engine/stator.rb,
lib/state_gate/engine/errator.rb,
lib/state_gate/engine/sequencer.rb,
lib/state_gate/engine/configurator.rb,
lib/state_gate/engine/transitioner.rb,
lib/state_gate/builder/scope_methods.rb,
lib/state_gate/builder/state_methods.rb,
lib/state_gate/builder/transition_methods.rb,
lib/state_gate/builder/conflict_detection_methods.rb,
lib/state_gate/builder/transition_validation_methods.rb,
lib/state_gate/builder/dynamic_module_creation_methods.rb

Overview

Version for StateGate

Defined Under Namespace

Modules: Assertions, VERSION Classes: Builder, ConfigurationError, ConflictError, Engine, Type

Class Method Summary collapse

Class Method Details

.gem_versionGem::Version

Returns the gem version.

Returns:

  • (Gem::Version)


13
14
15
# File 'lib/state_gate/version.rb', line 13

def self.gem_version
  Gem::Version.new VERSION::STRING
end

.symbolize(val) ⇒ Symbol?

Returns the Symbol version of the provided value as long as it responds to #to_s and has no included whitespace in the resulting String.

Examples:

StateGate.symbolize('Test')    #=> :test

StateGate.symbolize(:Test)     #=> :test

StateGate.symbolize('My Test') #=> nil

StateGate.symbolize('')        #=> nil

Parameters:

  • val (String, #to_s)

    the string to convert in to a Symbol

Returns:

  • (Symbol)

    the converted string

  • (nil)

    if the string cannot be converted



148
149
150
151
152
153
154
# File 'lib/state_gate.rb', line 148

def self.symbolize(val)
  return nil if     val.blank?
  return nil unless val.respond_to?(:to_s)
  return nil unless val.to_s.remove(/\s+/) == val.to_s

  val.to_s.downcase.to_sym
end