class Shoji::Base

Public Class Methods

foreach(filename, opts = {}, &block) click to toggle source
# File lib/shoji/base.rb, line 5
def self.foreach(filename, opts = {}, &block); raise NoMethodError.new; end
foreach_hash(filename, opts = {}, &block) click to toggle source
# File lib/shoji/base.rb, line 21
def self.foreach_hash(filename, opts = {}, &block)
  header = nil
  self.foreach(filename, opts) do |row|
    if header
      hash = Hash[*[header, row].transpose.flatten]
      block.call(hash)
    else
      header = row.map(&:to_sym)
    end
  end
end
row_size(filename, opts = {}) click to toggle source
# File lib/shoji/base.rb, line 8
def self.row_size(filename, opts = {}); raise NoMethodError.new; end
rows(filename, opts = {}) click to toggle source
# File lib/shoji/base.rb, line 7
def self.rows(filename, opts = {}); raise NoMethodError.new; end
valid_content?(content, opts = {}) click to toggle source
# File lib/shoji/base.rb, line 9
def self.valid_content?(content, opts = {})
  tf = Tempfile.new("shoji-base.#{$$}.data")
  tf.write content
  tf.close
  status = self.valid_file?(tf.path)
  tf.close(true)
  status
end
valid_file?(filename, opts = {}) click to toggle source
# File lib/shoji/base.rb, line 6
def self.valid_file?(filename, opts = {}); raise NoMethodError.new; end

Public Instance Methods

each(&block) click to toggle source
# File lib/shoji/base.rb, line 18
def each(&block)
  self.class.foreach(@filename, {}, &block)
end