Class: Filename

Inherits:
String show all
Defined in:
lib/linmeric/CnGal_new_classes.rb

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

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

Returns:

  • (Boolean)


296
297
298
# File 'lib/linmeric/CnGal_new_classes.rb', line 296

def is_a?(obj)
  self.class == obj ? (return true) : (return false)
end

#nameObject

  • 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_sObject



279
280
281
# File 'lib/linmeric/CnGal_new_classes.rb', line 279

def to_s
  return self
end