Class: Kanji::Type::AttributeDefiner
- Inherits:
-
Object
- Object
- Kanji::Type::AttributeDefiner
- Extended by:
- InstanceDefine
- Defined in:
- lib/kanji/type/attribute_definer.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(name, type = nil, description = nil, **kwargs, &block) ⇒ AttributeDefiner
constructor
A new instance of AttributeDefiner.
Methods included from InstanceDefine
Constructor Details
#initialize(name, type = nil, description = nil, **kwargs, &block) ⇒ AttributeDefiner
Returns a new instance of AttributeDefiner.
12 13 14 15 16 17 18 19 20 |
# File 'lib/kanji/type/attribute_definer.rb', line 12 def initialize(name, type = nil, description = nil, **kwargs, &block) @_name = name @_type = type @_description = description = kwargs self.instance_eval &block if block_given? raise AttributeError unless @_type end |
Instance Method Details
#call ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/kanji/type/attribute_definer.rb', line 22 def call Attribute.new({ name: @_name, type: @_type, description: @_description, options: , resolve: @_resolve }) end |