Class: Doodle::DataTypeHolder

Inherits:
Object
  • Object
show all
Defined in:
lib/doodle/datatype-holder.rb

Overview

implements the #doodle directive

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, &block) ⇒ DataTypeHolder

Returns a new instance of DataTypeHolder.



6
7
8
9
# File 'lib/doodle/datatype-holder.rb', line 6

def initialize(klass, &block)
  @klass = klass
  instance_eval(&block) if block_given?
end

Instance Attribute Details

#klassObject

Returns the value of attribute klass.



4
5
6
# File 'lib/doodle/datatype-holder.rb', line 4

def klass
  @klass
end

Instance Method Details

#arg_order(*args, &block) ⇒ Object



31
32
33
# File 'lib/doodle/datatype-holder.rb', line 31

def arg_order(*args, &block)
  @klass.class_eval { arg_order(*args, &block) }
end

#define(name, params, block, type_params, &type_block) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/doodle/datatype-holder.rb', line 11

def define(name, params, block, type_params, &type_block)
  @klass.class_eval {
    td = has(name, type_params.merge(params), &type_block)
    td.instance_eval(&block) if block
    td
  }
end

#doc(*args, &block) ⇒ Object



35
36
37
# File 'lib/doodle/datatype-holder.rb', line 35

def doc(*args, &block)
  @klass.class_eval { doc(*args, &block) }
end

#from(*args, &block) ⇒ Object



27
28
29
# File 'lib/doodle/datatype-holder.rb', line 27

def from(*args, &block)
  @klass.class_eval { from(*args, &block) }
end

#has(*args, &block) ⇒ Object



19
20
21
# File 'lib/doodle/datatype-holder.rb', line 19

def has(*args, &block)
  @klass.class_eval { has(*args, &block) }
end

#must(*args, &block) ⇒ Object



23
24
25
# File 'lib/doodle/datatype-holder.rb', line 23

def must(*args, &block)
  @klass.class_eval { must(*args, &block) }
end