Class: Attributor::Symbol

Inherits:
Object
  • Object
show all
Includes:
Type
Defined in:
lib/attributor/types/symbol.rb

Class Method Summary collapse

Methods included from Type

get_memoized_collection_class, set_memoized_collection_class

Class Method Details

.example(_context = nil, options: {}) ⇒ Object



15
16
17
# File 'lib/attributor/types/symbol.rb', line 15

def self.example(_context = nil, options: {})
  :example
end

.familyObject



19
20
21
# File 'lib/attributor/types/symbol.rb', line 19

def self.family
  String.family
end

.json_schema_typeObject



23
24
25
# File 'lib/attributor/types/symbol.rb', line 23

def self.json_schema_type
  :string
end

.load(value, context = Attributor::DEFAULT_ROOT_CONTEXT, **options) ⇒ Object



9
10
11
12
13
# File 'lib/attributor/types/symbol.rb', line 9

def self.load(value, context = Attributor::DEFAULT_ROOT_CONTEXT, **options)
  value.to_sym
rescue
  super
end

.native_typeObject



5
6
7
# File 'lib/attributor/types/symbol.rb', line 5

def self.native_type
  ::Symbol
end