Module: Trailblazer::Declarative

Defined in:
lib/trailblazer/declarative.rb,
lib/trailblazer/declarative/state.rb,
lib/trailblazer/declarative/schema.rb,
lib/trailblazer/declarative/version.rb

Defined Under Namespace

Modules: Schema Classes: Error, State

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.Schema(&block) ⇒ Object



3
4
5
6
7
8
# File 'lib/trailblazer/declarative/schema.rb', line 3

def self.Schema(&block)
  Class.new do
    extend Trailblazer::Declarative::Schema
    instance_exec(&block)
  end
end

.State(tuples = {}) ⇒ Object

Class-wide configuration data



4
5
6
7
8
# File 'lib/trailblazer/declarative/state.rb', line 4

def self.State(tuples={})
  state = State.new
  tuples.each { |path, (value, options)| state.add!(path, value, **options) }
  state
end