Class: Filename
Overview
Defining a subclass of string to identify a fileneme
- Author
-
Massimiliano Dal Mas ([email protected])
- License
-
Distributed under MIT license
Instance Method Summary collapse
-
#is_a?(obj) ⇒ Boolean
-
argument: class name * returns:
true
if ‘self.class` = `obj`;false
else.
-
-
#name ⇒ Object
-
returns: name of the file (‘String`).
-
- #to_s ⇒ Object
Methods inherited from String
#-, #compact, #contain?, #contain_all?, #float?, #integer?, #number?, #remove, #to_n
Instance Method Details
#is_a?(obj) ⇒ Boolean
-
argument: class name
-
returns:
true
if ‘self.class` = `obj`;false
else
296 297 298 |
# File 'lib/linmeric/CnGal_new_classes.rb', line 296 def is_a?(obj) self.class == obj ? (return true) : (return false) end |
#name ⇒ Object
-
returns: name of the file (‘String`)
284 285 286 287 288 289 290 291 292 |
# File 'lib/linmeric/CnGal_new_classes.rb', line 284 def name i = self.size - 1 nm = '' while self[i] != '/' do nm += self[i] i -= 1 end return nm.reverse end |
#to_s ⇒ Object
279 280 281 |
# File 'lib/linmeric/CnGal_new_classes.rb', line 279 def to_s return self end |