Class: EnumValue
- Includes:
- Trax::Core::AbstractMethods
- Defined in:
- lib/trax/core/primitives/enum_value.rb
Class Method Summary collapse
-
.==(val) ⇒ Object
maybe this is a bad idea, not entirely sure.
- .===(val) ⇒ Object
- .as_json(options = {}) ⇒ Object
- .enum ⇒ Object
- .include?(val) ⇒ Boolean
- .inspect ⇒ Object
- .is_enum_value?(val) ⇒ Boolean
- .to_i ⇒ Object
- .to_s ⇒ Object
- .to_schema ⇒ Object
- .to_sym ⇒ Object
Class Method Details
.==(val) ⇒ Object
maybe this is a bad idea, not entirely sure
49 50 51 |
# File 'lib/trax/core/primitives/enum_value.rb', line 49 def self.==(val) self.=== val end |
.===(val) ⇒ Object
53 54 55 |
# File 'lib/trax/core/primitives/enum_value.rb', line 53 def self.===(val) [tag, to_s, to_i].include?(val) end |
.as_json(options = {}) ⇒ Object
7 8 9 |
# File 'lib/trax/core/primitives/enum_value.rb', line 7 def self.as_json(={}) tag.to_s end |
.enum ⇒ Object
11 12 13 |
# File 'lib/trax/core/primitives/enum_value.rb', line 11 def self.enum parent end |
.include?(val) ⇒ Boolean
44 45 46 |
# File 'lib/trax/core/primitives/enum_value.rb', line 44 def self.include?(val) self.=== val end |
.inspect ⇒ Object
40 41 42 |
# File 'lib/trax/core/primitives/enum_value.rb', line 40 def self.inspect ":#{tag}" end |
.is_enum_value?(val) ⇒ Boolean
27 28 29 |
# File 'lib/trax/core/primitives/enum_value.rb', line 27 def self.is_enum_value?(val) val == parent end |
.to_i ⇒ Object
23 24 25 |
# File 'lib/trax/core/primitives/enum_value.rb', line 23 def self.to_i value end |
.to_s ⇒ Object
15 16 17 |
# File 'lib/trax/core/primitives/enum_value.rb', line 15 def self.to_s tag.to_s end |
.to_schema ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/trax/core/primitives/enum_value.rb', line 31 def self.to_schema ::Trax::Core::Definition.new( :source => self.name, :name => to_s, :type => :enum_value, :integer_value => to_i ) end |
.to_sym ⇒ Object
19 20 21 |
# File 'lib/trax/core/primitives/enum_value.rb', line 19 def self.to_sym tag end |