Class: Cheri::Explorer::NameValue
- Inherits:
-
Object
- Object
- Cheri::Explorer::NameValue
- Defined in:
- lib/cheri/explorer/explorer.rb
Overview
ValueType
Direct Known Subclasses
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #id ⇒ Object
-
#initialize(name, value) ⇒ NameValue
constructor
A new instance of NameValue.
- #name ⇒ Object
- #to_a ⇒ Object (also: #to_ary)
- #value ⇒ Object
Constructor Details
#initialize(name, value) ⇒ NameValue
Returns a new instance of NameValue.
190 191 192 193 194 195 |
# File 'lib/cheri/explorer/explorer.rb', line 190 def initialize(name,value) raise Cheri.type_error(name,String) unless String === name @n = name @i = value.__id__ rescue '?' @v = String === value ? value[0,128] : (value.to_s[0,128] rescue '?') end |
Instance Method Details
#<=>(other) ⇒ Object
205 206 207 208 209 210 211 |
# File 'lib/cheri/explorer/explorer.rb', line 205 def <=>(other) if NameValue === other value <=> other.value else value <=> (other.to_s rescue '') end end |
#id ⇒ Object
202 203 204 |
# File 'lib/cheri/explorer/explorer.rb', line 202 def id @i end |
#name ⇒ Object
196 197 198 |
# File 'lib/cheri/explorer/explorer.rb', line 196 def name @n end |
#to_a ⇒ Object Also known as: to_ary
212 213 214 |
# File 'lib/cheri/explorer/explorer.rb', line 212 def to_a [@n,@v,@i] end |
#value ⇒ Object
199 200 201 |
# File 'lib/cheri/explorer/explorer.rb', line 199 def value @v end |