Module: COS::Struct::Base::AttrHelper

Included in:
COS::Struct::Base
Defined in:
lib/cos/struct.rb

Instance Method Summary collapse

Instance Method Details

#optional_attrs(*s) ⇒ Object

动态创建可选参数


16
17
18
19
# File 'lib/cos/struct.rb', line 16

def optional_attrs(*s)
  define_method(:optional_attrs) {s}
  attr_reader(*s)
end

#required_attrs(*s) ⇒ Object

动态创建必选参数


10
11
12
13
# File 'lib/cos/struct.rb', line 10

def required_attrs(*s)
  define_method(:required_attrs) {s}
  attr_reader(*s)
end