Module: RDL::RDLAnnotate

Included in:
ActiveRecord::Associations::ClassMethods, ActiveRecord::Base, ActiveRecord::ModelSchema::ClassMethods
Defined in:
lib/rdl/wrap.rb,
lib/rdl_disable.rb

Overview

all methods in RDL::Annotate but with an ‘rdl_` prefix

Instance Method Summary collapse

Instance Method Details

#rdl_attr_accessor_type(*args) ⇒ Object

Need to duplicate these methods because they need to call rdl_var_type and rdl_type and couldn’t figure out how to do instance_method with a partial argument binding



521
522
523
524
525
526
527
528
529
# File 'lib/rdl/wrap.rb', line 521

def rdl_attr_accessor_type(*args)
  args.each_slice(2) { |name, typ|
    attr_accessor name
    rdl_var_type ("@" + name.to_s), typ
    rdl_type name, "() -> #{typ}"
    rdl_type name.to_s + "=", "(#{typ}) -> #{typ}"
  }
  nil
end

#rdl_attr_reader_type(*args) ⇒ Object Also known as: rdl_attr_type



531
532
533
534
535
536
537
538
# File 'lib/rdl/wrap.rb', line 531

def rdl_attr_reader_type(*args)
  args.each_slice(2) { |name, typ|
    attr_reader name
    rdl_var_type ("@" + name.to_s), typ
    rdl_type name, "() -> #{typ}"
  }
  nil
end

#rdl_attr_writer_type(*args) ⇒ Object



542
543
544
545
546
547
548
549
# File 'lib/rdl/wrap.rb', line 542

def rdl_attr_writer_type(*args)
  args.each_slice(2) { |name, typ|
    attr_writer name
    rdl_var_type ("@" + name.to_s), typ
    rdl_type name.to_s + "=", "(#{typ}) -> #{typ}"
  }
  nil
end