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:
trueif ‘self.class` = `obj`;falseelse.
-
-
#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:
trueif ‘self.class` = `obj`;falseelse
284 285 286 |
# File 'lib/linmeric/CnGal_new_classes.rb', line 284 def is_a?(obj) self.class == obj ? (return true) : (return false) end |
#name ⇒ Object
-
returns: name of the file (‘String`)
272 273 274 275 276 277 278 279 280 |
# File 'lib/linmeric/CnGal_new_classes.rb', line 272 def name i = self.size - 1 nm = '' while self[i] != '/' do nm += self[i] i -= 1 end return nm.reverse end |
#to_s ⇒ Object
267 268 269 |
# File 'lib/linmeric/CnGal_new_classes.rb', line 267 def to_s return self end |