Class: Mspire::Mascot::Dat::Query

Inherits:
Hash
  • Object
show all
Includes:
Castable
Defined in:
lib/mspire/mascot/dat/query.rb

Constant Summary collapse

CAST =
{
  charge: Cast::FROM_CHARGE_STRING,
  title: Cast::CGI_UNESCAPE,
  mass_min: :to_f,
  mass_max: :to_f,
  int_min: :to_f,
  int_max: :to_f,
  num_vals: :to_i,
  num_used1: :to_i,
  index: :to_i,
  Ions1: Cast::FLOAT_PAIRS,
}

Instance Method Summary collapse

Methods included from Castable

#cast!

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/mspire/mascot/dat/query.rb', line 36

def method_missing(*args, &block)
  if args[0].to_s[-1] == '='
    if self.key?(args[0...-1])
      self[ args[0...-1] ] = args[1]
    else
      super(*args, &block)
    end
  else
    if self.key?(args[0])
      self[ args[0] ]
    else
      super(*args, &block)
    end
  end
end

Instance Method Details

#from_io!(io) ⇒ Object

returns self



27
28
29
30
31
32
# File 'lib/mspire/mascot/dat/query.rb', line 27

def from_io!(io)
  Dat.each_key_val(io) do |key,val|
    self[key.to_sym] = val
  end
  cast!
end

#peaksObject



34
# File 'lib/mspire/mascot/dat/query.rb', line 34

def peaks() self[:Ions1] end