Sha256: f95e83199b9266b6b88605746d91c230fd266cc2e15a8a8daf5c8f3dbdc402a3

Contents?: true

Size: 1.03 KB

Versions: 49

Compression:

Stored size: 1.03 KB

Contents

# skeleton

class RuneBlog
  module Helpers
  end

  class Default
  end

  class View
  end

  class Publishing
  end

  class Post
  end
end

def make_exception(sym, str)
  return if Object.constants.include?(sym)
  Object.const_set(sym, StandardError.dup)
  define_method(sym) do |*args|
    msg = str
    args.each.with_index {|arg, i| msg.sub!("$#{i+1}", arg) }
    Object.class_eval(sym.to_s).new(msg)
  end
end

def prefix(num)
  "#{'%04d' % num.to_i}"
end

def check_meta(meta, where = "")
  str =  "--- #{where}\n"
  str << "\ncheck_meta: \n" + caller.join("\n") + "\n  meta = #{meta.inspect}\n"
  str << "  title missing!\n" unless meta.title
  str << "  title missing! (empty)" if meta.title && meta.title.empty?
  str << "  num missing!\n" unless meta.num
  if str =~ /missing!/
    debug str
    raise str 
  end
end

def verify(hash)
  hash.each_pair do |expr, msg|
    puts "<< #{msg}" unless expr
  end
end

def assure(hash)  # really the same as verify for now...
  hash.each_pair do |expr, msg|
    puts "<< #{msg}" unless expr
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
runeblog-0.1.75 lib/global.rb
runeblog-0.1.74 lib/global.rb
runeblog-0.1.73 lib/global.rb
runeblog-0.1.71 lib/global.rb
runeblog-0.1.70 lib/global.rb
runeblog-0.1.69 lib/global.rb
runeblog-0.1.68 lib/global.rb
runeblog-0.1.67 lib/global.rb
runeblog-0.1.66 lib/global.rb
runeblog-0.1.65 lib/global.rb
runeblog-0.1.64 lib/global.rb
runeblog-0.1.63 lib/global.rb
runeblog-0.1.62 lib/global.rb
runeblog-0.1.61 lib/global.rb
runeblog-0.1.59 lib/global.rb
runeblog-0.1.58 lib/global.rb
runeblog-0.1.57 lib/global.rb
runeblog-0.1.56 lib/global.rb
runeblog-0.1.55 lib/global.rb
runeblog-0.1.54 lib/global.rb