Class: EDN::Type::Symbol

Inherits:
Object
  • Object
show all
Includes:
CoreExt::AllowsMetadata
Defined in:
lib/edn/type/symbol.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CoreExt::AllowsMetadata

#allows_metadata?

Constructor Details

#initialize(sym) ⇒ Symbol

Returns a new instance of Symbol


8
9
10
# File 'lib/edn/type/symbol.rb', line 8

def initialize(sym)
  @symbol = sym.to_sym
end

Instance Attribute Details

#symbolObject (readonly)

Returns the value of attribute symbol


6
7
8
# File 'lib/edn/type/symbol.rb', line 6

def symbol
  @symbol
end

Instance Method Details

#==(other) ⇒ Object


12
13
14
15
# File 'lib/edn/type/symbol.rb', line 12

def ==(other)
  return false unless other.is_a?(Symbol)
  to_sym == other.to_sym
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)

17
18
19
20
# File 'lib/edn/type/symbol.rb', line 17

def eql?(other)
  return false unless other.is_a?(Symbol)
  to_sym == other.to_sym
end

#hashObject


22
23
24
# File 'lib/edn/type/symbol.rb', line 22

def hash
  @symbol.hash
end

#to_ednObject


34
35
36
# File 'lib/edn/type/symbol.rb', line 34

def to_edn
  @symbol.to_s
end

#to_sObject


30
31
32
# File 'lib/edn/type/symbol.rb', line 30

def to_s
  @symbol.to_s
end

#to_symObject


26
27
28
# File 'lib/edn/type/symbol.rb', line 26

def to_sym
  @symbol
end