Class: Clojure::Symbol
- Inherits:
-
Object
- Object
- Clojure::Symbol
- Defined in:
- lib/clj/types.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(sym) ⇒ Symbol
constructor
A new instance of Symbol.
- #inspect ⇒ Object
- #keyword? ⇒ Boolean
- #symbol? ⇒ Boolean
- #to_clj ⇒ Object
- #to_s ⇒ Object
- #to_sym ⇒ Object
Constructor Details
#initialize(sym) ⇒ Symbol
Returns a new instance of Symbol.
83 84 85 |
# File 'lib/clj/types.rb', line 83 def initialize (sym) @internal = sym end |
Instance Method Details
#==(other) ⇒ Object
100 101 102 103 104 |
# File 'lib/clj/types.rb', line 100 def == (other) return false unless other.is_a?(Symbol) to_sym == other.to_sym end |
#inspect ⇒ Object
108 |
# File 'lib/clj/types.rb', line 108 def inspect; to_s end |
#keyword? ⇒ Boolean
87 |
# File 'lib/clj/types.rb', line 87 def keyword?; false; end |
#symbol? ⇒ Boolean
88 |
# File 'lib/clj/types.rb', line 88 def symbol?; true; end |
#to_clj ⇒ Object
90 91 92 93 94 95 96 97 98 |
# File 'lib/clj/types.rb', line 90 def to_clj (*) result = to_sym.to_s unless result =~ %r([\w:+!-_?./][\w\d:+!-_?./]*) raise ArgumentError, "#{result} cannot be transformed into clojure" end result end |
#to_s ⇒ Object
107 |
# File 'lib/clj/types.rb', line 107 def to_s; to_sym.to_s; end |
#to_sym ⇒ Object
106 |
# File 'lib/clj/types.rb', line 106 def to_sym; @internal; end |