Sha256: 09d9ae6b7ed39eea7d0ed791dc73e1ac922e33b8fbc2f9877e163fd7649a6966

Contents?: true

Size: 1.07 KB

Versions: 25

Compression:

Stored size: 1.07 KB

Contents

# skeleton

class RuneBlog
  module Helpers
  end

  class Default
  end

  class View
  end

  class Publishing
  end

  class Post
  end
end

# Refactor, move stuff elsewhere?

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

25 entries across 25 versions & 1 rubygems

Version Path
runeblog-0.2.3 lib/global.rb
runeblog-0.2.2 lib/global.rb
runeblog-0.2.1 lib/global.rb
runeblog-0.1.99 lib/global.rb
runeblog-0.1.98 lib/global.rb
runeblog-0.1.97 lib/global.rb
runeblog-0.1.96 lib/global.rb
runeblog-0.1.95 lib/global.rb
runeblog-0.1.94 lib/global.rb
runeblog-0.1.93 lib/global.rb
runeblog-0.1.92 lib/global.rb
runeblog-0.1.91 lib/global.rb
runeblog-0.1.90 lib/global.rb
runeblog-0.1.89 lib/global.rb
runeblog-0.1.88 lib/global.rb
runeblog-0.1.86 lib/global.rb
runeblog-0.1.85 lib/global.rb
runeblog-0.1.84 lib/global.rb
runeblog-0.1.83 lib/global.rb
runeblog-0.1.82 lib/global.rb