Module: Faith::DSL

Defined in:
lib/faith/dsl.rb

Defined Under Namespace

Classes: ChildBuilder, MixinBuilder

Class Method Summary collapse

Class Method Details

.to_root(&block) ⇒ Object



5
6
7
8
9
10
# File 'lib/faith/dsl.rb', line 5

def self.to_root(&block)
  root = Faith::Group.new('root', nil, [])
  Docile.dsl_eval(ChildBuilder.new(root), &block)
  root.resolve_self!
  root
end

.validate_name!(name) ⇒ Object

Raises:

  • (ArgumentError)


12
13
14
15
# File 'lib/faith/dsl.rb', line 12

def self.validate_name!(name)
  raise ArgumentError, 'names cannot include :' if name.include?(':')
  raise ArgumentError, '\'root\' is a reserved name' if name == 'root'
end