Class: SakaiInfo::SiteProperty

Inherits:
Object
  • Object
show all
Defined in:
lib/sakai-info/site.rb

Class Method Summary collapse

Class Method Details

.find_by_site_id(site_id) ⇒ Object



513
514
515
516
517
518
519
520
# File 'lib/sakai-info/site.rb', line 513

def self.find_by_site_id(site_id)
  properties = {}
  DB.connect[:sakai_site_property].
    where(:site_id => site_id).all.each do |row|
    properties[row[:name]] = row[:value].read
  end
  return properties
end

.find_site_ids_by_property(name, value) ⇒ Object



522
523
524
525
526
# File 'lib/sakai-info/site.rb', line 522

def self.find_site_ids_by_property(name, value)
  DB.connect[:sakai_site_property].
    where(:name => name, Sequel.function(:to_char, :value) => value).
    all.collect{|r| r[:site_id]}
end

.get(site_id, property_name) ⇒ Object



503
504
505
506
507
508
509
510
511
# File 'lib/sakai-info/site.rb', line 503

def self.get(site_id, property_name)
  row = DB.connect[:sakai_site_property].
    where(:site_id => site_id, :name => property_name).first
  if row.nil?
    nil
  else
    row[:value].read
  end
end