Module: Dialekt::Dsl::ClassMixins

Defined in:
lib/dialekt/dsl.rb

Overview

DSL mixins for Class

Instance Method Summary collapse

Instance Method Details

#dsl_map(name, **options, &block) ⇒ Object



15
16
17
18
19
20
# File 'lib/dialekt/dsl.rb', line 15

def dsl_map(name, **options, &block)
  property = Model::MapProperty.new(name: name, **options)
  Docile.dsl_eval(property, &block) if block
  property.setup(owner: self)
  property
end

#dsl_scalar(name, **options, &block) ⇒ Object



8
9
10
11
12
13
# File 'lib/dialekt/dsl.rb', line 8

def dsl_scalar(name, **options, &block)
  property = Model::ScalarProperty.new(name: name, **options)
  Docile.dsl_eval(property, &block) if block
  property.setup(owner: self)
  property
end

#dsl_set(name, **options, &block) ⇒ Object



22
23
24
25
26
27
# File 'lib/dialekt/dsl.rb', line 22

def dsl_set(name, **options, &block)
  property = Model::SetProperty.new(name: name, **options)
  Docile.dsl_eval(property, &block) if block
  property.setup(owner: self)
  property
end