Sha256: 959729c8a0ef56eaa2d1fee6edc66f3f9ec5b3b59ff2af2f01ead2fd05011dee

Contents?: true

Size: 588 Bytes

Versions: 65

Compression:

Stored size: 588 Bytes

Contents

class Marty::ApiConfig < Marty::Base
  validates_presence_of :script

  def self.lookup(script, node, attr)
    res = where(["script = ? AND (node IS NULL OR node = ?) "\
           "AND (attr IS NULL OR attr = ?)",
           script, node, attr]).
           order('node nulls last, attr nulls last').
           pluck(:logged, :input_validated, :output_validated, :strict_validate,
                 :id)
    res.first
  end
  def self.multi_lookup(script, node, attrs)
    (attrs.nil? ? [nil] : attrs).
      map { |attr| lookup(script, node, attr).try{|x| x.unshift(attr) }}
  end
end

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
marty-2.3.15 app/models/marty/api_config.rb
marty-2.3.14 app/models/marty/api_config.rb
marty-2.3.13 app/models/marty/api_config.rb
marty-2.3.12 app/models/marty/api_config.rb
marty-2.3.11 app/models/marty/api_config.rb
marty-2.3.10 app/models/marty/api_config.rb
marty-2.3.9 app/models/marty/api_config.rb
marty-2.3.8 app/models/marty/api_config.rb
marty-2.3.7 app/models/marty/api_config.rb
marty-2.3.5 app/models/marty/api_config.rb
marty-2.3.4 app/models/marty/api_config.rb
marty-2.1.5 app/models/marty/api_config.rb
marty-2.3.2 app/models/marty/api_config.rb
marty-2.3.1 app/models/marty/api_config.rb
marty-2.3.0 app/models/marty/api_config.rb
marty-2.1.4 app/models/marty/api_config.rb
marty-2.1.3 app/models/marty/api_config.rb
marty-2.1.2 app/models/marty/api_config.rb
marty-2.1.1 app/models/marty/api_config.rb
marty-2.1.0 app/models/marty/api_config.rb