Module: Crystalline::Enum
- Included in:
- CldProvisioning::Models::Shared::ManagementTypeEnum, CldProvisioning::Models::Shared::PermissionTypeEnum, CldProvisioning::Models::Shared::PrincipalTypeEnum, CldProvisioning::Models::Shared::ScopeTypeEnum
- Defined in:
- lib/crystalline/types.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
- #initialize(val) ⇒ Object
- #inspect ⇒ Object
- #known? ⇒ Boolean
- #serialize ⇒ Object
- #to_s ⇒ Object
Class Method Details
.included(base) ⇒ Object
97 98 99 |
# File 'lib/crystalline/types.rb', line 97 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#==(other) ⇒ Object
158 159 160 161 |
# File 'lib/crystalline/types.rb', line 158 def ==(other) other = other.serialize if other.is_a?(self.class) @val == other end |
#eql?(other) ⇒ Boolean
163 164 165 |
# File 'lib/crystalline/types.rb', line 163 def eql?(other) self == other end |
#hash ⇒ Object
167 168 169 |
# File 'lib/crystalline/types.rb', line 167 def hash @val.hash end |
#initialize(val) ⇒ Object
101 102 103 104 105 106 107 |
# File 'lib/crystalline/types.rb', line 101 def initialize(val) if self.class.instance_methods(false).include?(:initialize) super(val) else @val = val end end |
#inspect ⇒ Object
150 151 152 |
# File 'lib/crystalline/types.rb', line 150 def inspect "#<#{self.class} #{serialize.inspect}>" end |
#known? ⇒ Boolean
154 155 156 |
# File 'lib/crystalline/types.rb', line 154 def known? self.class.instance_variable_get(:@mapping)&.value?(self) || false end |
#serialize ⇒ Object
142 143 144 |
# File 'lib/crystalline/types.rb', line 142 def serialize @val end |
#to_s ⇒ Object
146 147 148 |
# File 'lib/crystalline/types.rb', line 146 def to_s serialize.to_s end |