Class: Dim

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

Overview

Definition of a dimension (structure: from-to)

Author

Massimiliano Dal Mas ([email protected])

License

Distributed under MIT license

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ Dim

  • argument: string to be converted to a dimension



299
300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/linmeric/CnGal_new_classes.rb', line 299

def initialize(str)
  str = str - '"'
  str = str.split(',')
  if str.size == 2 and str[0] != "" and str[1] != "" then
    str.each do |val|
      puts '  Argument Error: wrong range format' unless val.number?
    end
    @sx = str[0].to_n
    @dx = str[1].to_n
  else
    puts '  Argument Error: wrong range format'
  end
end

Instance Method Details

#dxObject

  • returns: right dimension value



319
320
321
# File 'lib/linmeric/CnGal_new_classes.rb', line 319

def dx()
  return @dx
end

#sxObject

  • returns: left dimension value



314
315
316
# File 'lib/linmeric/CnGal_new_classes.rb', line 314

def sx()
  return @sx
end