| Total Complexity | 11 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | # frozen_string_literal: true |
||
| 11 | class Any < Type |
||
| 12 | include Mixin::Errors |
||
| 13 | |||
| 14 | def initialize |
||
| 15 | super(self.class) |
||
| 16 | denormalizer_block { |entity, *| entity } |
||
| 17 | normalizer_block { |entity, *| entity } |
||
| 18 | validator_block { |*| [] } |
||
| 19 | end |
||
| 20 | |||
| 21 | INSTANCE = new |
||
| 22 | |||
| 23 | def parameters |
||
| 24 | {} |
||
| 25 | end |
||
| 26 | |||
| 27 | def attributes |
||
| 28 | {} |
||
| 29 | end |
||
| 30 | |||
| 31 | def parameter!(*) |
||
| 32 | compliance_error('Tried to declare parameter on Any type') |
||
| 33 | end |
||
| 34 | |||
| 35 | def resolve_parameter(*) |
||
| 36 | self |
||
| 37 | end |
||
| 38 | |||
| 39 | def instance?(object, *) |
||
| 40 | !object.nil? |
||
| 41 | end |
||
| 42 | |||
| 43 | def hash |
||
| 44 | self.class.hash |
||
| 45 | end |
||
| 46 | |||
| 47 | def eql?(other) |
||
| 48 | other.is_a?(Type) |
||
| 49 | end |
||
| 50 | |||
| 51 | def ==(other) |
||
| 52 | eql?(other) |
||
| 53 | end |
||
| 54 | |||
| 55 | def to_s |
||
| 56 | 'Any Type' |
||
| 57 | end |
||
| 58 | |||
| 59 | def to_def |
||
| 60 | '*' |
||
| 61 | end |
||
| 62 | end |
||
| 63 | end |
||
| 67 |