Class: AMA::Entity::Mapper::Type::Any
Overview
Used as a wildcard to pass anything through
Constant Summary
collapse
- INSTANCE =
new
Instance Attribute Summary
#denormalizer, #enumerator, #factory, #injector, #normalizer, #type, #virtual
Instance Method Summary
collapse
#compliance_error, #mapping_error, #raise_if_internal, #validation_error
#attribute!, #instance!, #resolve, #resolved!, #resolved?, #valid!, #valid?, #violations
declare_handler_block_setter, declare_handler_getter, declare_handler_method, declare_handler_setter, declare_namespace_method, included
#install_object_method, #method_object, #object_variable, #object_variable_exists, #object_variables, #set_object_attribute
Constructor Details
#initialize ⇒ Any
Returns a new instance of Any.
14
15
16
17
18
19
|
# File 'lib/ama-entity-mapper/type/any.rb', line 14
def initialize
super(self.class)
denormalizer_block { |entity, *| entity }
normalizer_block { |entity, *| entity }
validator_block { |*| [] }
end
|
Instance Method Details
#==(other) ⇒ Object
51
52
53
|
# File 'lib/ama-entity-mapper/type/any.rb', line 51
def ==(other)
eql?(other)
end
|
#attributes ⇒ Object
27
28
29
|
# File 'lib/ama-entity-mapper/type/any.rb', line 27
def attributes
{}
end
|
#eql?(other) ⇒ Boolean
47
48
49
|
# File 'lib/ama-entity-mapper/type/any.rb', line 47
def eql?(other)
other.is_a?(Type)
end
|
#hash ⇒ Object
43
44
45
|
# File 'lib/ama-entity-mapper/type/any.rb', line 43
def hash
self.class.hash
end
|
#instance?(object) ⇒ Boolean
39
40
41
|
# File 'lib/ama-entity-mapper/type/any.rb', line 39
def instance?(object, *)
!object.nil?
end
|
#parameter! ⇒ Object
31
32
33
|
# File 'lib/ama-entity-mapper/type/any.rb', line 31
def parameter!(*)
compliance_error('Tried to declare parameter on Any type')
end
|
#parameters ⇒ Object
23
24
25
|
# File 'lib/ama-entity-mapper/type/any.rb', line 23
def parameters
{}
end
|
#resolve_parameter ⇒ Object
35
36
37
|
# File 'lib/ama-entity-mapper/type/any.rb', line 35
def resolve_parameter(*)
self
end
|
#to_def ⇒ Object
59
60
61
|
# File 'lib/ama-entity-mapper/type/any.rb', line 59
def to_def
'*'
end
|
#to_s ⇒ Object
55
56
57
|
# File 'lib/ama-entity-mapper/type/any.rb', line 55
def to_s
'Any Type'
end
|