Class: EDN::Type::Symbol
- Inherits:
-
Object
- Object
- EDN::Type::Symbol
- Includes:
- CoreExt::AllowsMetadata
- Defined in:
- lib/edn/type/symbol.rb
Instance Attribute Summary collapse
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(sym) ⇒ Symbol
constructor
A new instance of Symbol.
- #to_edn ⇒ Object
- #to_s ⇒ Object
- #to_sym ⇒ Object
Methods included from CoreExt::AllowsMetadata
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
#symbol ⇒ Object (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
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 |
#hash ⇒ Object
22 23 24 |
# File 'lib/edn/type/symbol.rb', line 22 def hash @symbol.hash end |
#to_edn ⇒ Object
34 35 36 |
# File 'lib/edn/type/symbol.rb', line 34 def to_edn @symbol.to_s end |
#to_s ⇒ Object
30 31 32 |
# File 'lib/edn/type/symbol.rb', line 30 def to_s @symbol.to_s end |
#to_sym ⇒ Object
26 27 28 |
# File 'lib/edn/type/symbol.rb', line 26 def to_sym @symbol end |