Class: Clojure::Symbol

Inherits:
Object
  • Object
show all
Defined in:
lib/clj/types.rb

Instance Method Summary collapse

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

#inspectObject



108
# File 'lib/clj/types.rb', line 108

def inspect; to_s          end

#keyword?Boolean

Returns:

  • (Boolean)


87
# File 'lib/clj/types.rb', line 87

def keyword?; false; end

#symbol?Boolean

Returns:

  • (Boolean)


88
# File 'lib/clj/types.rb', line 88

def symbol?;  true;  end

#to_cljObject



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_sObject



107
# File 'lib/clj/types.rb', line 107

def to_s;    to_sym.to_s;  end

#to_symObject



106
# File 'lib/clj/types.rb', line 106

def to_sym;  @internal;    end