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



311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/linmeric/CnGal_new_classes.rb', line 311

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



331
332
333
# File 'lib/linmeric/CnGal_new_classes.rb', line 331

def dx()
  return @dx
end

#sxObject

  • returns: left dimension value



326
327
328
# File 'lib/linmeric/CnGal_new_classes.rb', line 326

def sx()
  return @sx
end