Class: Doodle::DataTypeHolder

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, &block) ⇒ DataTypeHolder

Returns a new instance of DataTypeHolder.



437
438
439
440
# File 'lib/doodle.rb', line 437

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

Instance Attribute Details

#klassObject

Returns the value of attribute klass.



436
437
438
# File 'lib/doodle.rb', line 436

def klass
  @klass
end

Instance Method Details

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



441
442
443
444
445
446
447
# File 'lib/doodle.rb', line 441

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