Class: DrySchemaExtend::FieldExtendedInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/zleb/plugins/schema_compiler.rb

Instance Method Summary collapse

Constructor Details

#initialize(field_name) ⇒ FieldExtendedInfo

Returns a new instance of FieldExtendedInfo.



221
222
223
224
# File 'lib/zleb/plugins/schema_compiler.rb', line 221

def initialize(field_name)
  @field_name = field_name
  @desc = nil
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



246
247
248
# File 'lib/zleb/plugins/schema_compiler.rb', line 246

def method_missing(method_name, *args, &block)
  rest_method(method_name, *args, &block)
end

Instance Method Details

#desc(**info) ⇒ Object



226
227
228
229
# File 'lib/zleb/plugins/schema_compiler.rb', line 226

def desc(**info)
  @desc = info
  self
end

#get_descObject



232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/zleb/plugins/schema_compiler.rb', line 232

def get_desc
  result = {}
  if @children
    if @is_member
      result[:member] = {}
      result[:member][:children] = @children.get_desc
    else
      result[:children] = @children.get_desc
    end
  end
  result[:desc] = @desc if @desc
  result
end

#hash(*arg, &block) ⇒ Object



250
251
252
# File 'lib/zleb/plugins/schema_compiler.rb', line 250

def hash(*arg, &block)
  rest_method(:hash, *arg, &block)
end