Class: Field::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/field/base.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/field/base.rb', line 4

def name
  @name
end

#translatedObject

Returns the value of attribute translated.



4
5
6
# File 'lib/field/base.rb', line 4

def translated
  @translated
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/field/base.rb', line 4

def type
  @type
end

Class Method Details

.fetch(type) ⇒ Object

Raises:

  • (::ArgumentError)


6
7
8
9
10
# File 'lib/field/base.rb', line 6

def self.fetch(type)
  raise ::ArgumentError, "Unsupported type #{type}" unless supported_types.include?(type.to_sym)

  "Field::Types::#{type.classify}".constantize.new
end

.supported_typesObject



20
21
22
# File 'lib/field/base.rb', line 20

def self.supported_types
  []
end

Instance Method Details

#json_schema_formatObject



12
13
14
# File 'lib/field/base.rb', line 12

def json_schema_format
  ''
end

#json_schema_patternObject



24
25
26
# File 'lib/field/base.rb', line 24

def json_schema_pattern
  ''
end

#json_schema_typeObject



16
17
18
# File 'lib/field/base.rb', line 16

def json_schema_type
  :string
end