Class: EnumValue

Inherits:
Object show all
Includes:
Trax::Core::AbstractMethods
Defined in:
lib/trax/core/primitives/enum_value.rb

Class Method Summary collapse

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(options={})
  tag.to_s
end

.enumObject



11
12
13
# File 'lib/trax/core/primitives/enum_value.rb', line 11

def self.enum
  parent
end

.include?(val) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/trax/core/primitives/enum_value.rb', line 44

def self.include?(val)
  self.=== val
end

.inspectObject



40
41
42
# File 'lib/trax/core/primitives/enum_value.rb', line 40

def self.inspect
  ":#{tag}"
end

.is_enum_value?(val) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/trax/core/primitives/enum_value.rb', line 27

def self.is_enum_value?(val)
  val == parent
end

.to_iObject



23
24
25
# File 'lib/trax/core/primitives/enum_value.rb', line 23

def self.to_i
  value
end

.to_sObject



15
16
17
# File 'lib/trax/core/primitives/enum_value.rb', line 15

def self.to_s
  tag.to_s
end

.to_schemaObject



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_symObject



19
20
21
# File 'lib/trax/core/primitives/enum_value.rb', line 19

def self.to_sym
  tag
end