Method: Attributor::Type::ClassMethods#describe

Defined in:
lib/attributor/type.rb

#describe(_root = false, example: nil) ⇒ Object

Default describe for simple types…only their name (stripping the base attributor module)



160
161
162
163
164
165
166
167
168
169
170
# File 'lib/attributor/type.rb', line 160

def describe(_root = false, example: nil)
  type_name = Attributor.type_name(self)
  hash = {
    name: type_name.gsub(Attributor::MODULE_PREFIX_REGEX, ''),
    family: family,
    id: id
  }
  hash[:anonymous] = @_anonymous unless @_anonymous.nil?
  hash[:example] = example if example
  hash
end