Sha256: 2a25b5fae38bef08f838ec13ba8fe4bfdd6631e6b0bc5c46bb890c293cdb8dd5

Contents?: true

Size: 1.1 KB

Versions: 14

Compression:

Stored size: 1.1 KB

Contents

$knjpath = "knj/" if !$knjpath

module Knj
  CONFIG = {}
  
  def self.const_missing(name)
    if name == :Db
      filepath = "#{$knjpath}knjdb/libknjdb"
    else
      filepath = "#{$knjpath}#{name.to_s.downcase}"
    end
    
    require filepath
    raise "Constant still not defined: '#{name}'." if !Knj.const_defined?(name)
    return Knj.const_get(name)
  end
  
  def self.appserver_cli(filename)
    Knj::Os.chdir_file(filename)
    require "#{$knjpath}/includes/appserver_cli.rb"
  end
  
  def self.dirname(filepath)
    raise "Filepath does not exist: #{filepath}" if !File.exists?(filepath)
    return File.realpath(File.dirname(filepath))
  end
  
  #Returns the path of the knjrbfw-framework.
  def self.knjrbfw_path
    return File.realpath(File.dirname(__FILE__))
  end
  
  #Shortcut to Php4r.print_r.
  def self.p(*args, &block)
    require "php4r" if !Kernel.const_defined?(:Php4r)
    return Php4r.print_r(*args, &block)
  end
  
  def self.handle_return(args)
    if args[:block]
      args[:enum].each(&args[:block])
      return nil
    else
      return Array_enumerator.new(args[:enum])
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
knjrbfw-0.0.90 lib/knj/knj.rb
knjrbfw-0.0.89 lib/knj/knj.rb
knjrbfw-0.0.88 lib/knj/knj.rb
knjrbfw-0.0.87 lib/knj/knj.rb
knjrbfw-0.0.86 lib/knj/knj.rb
knjrbfw-0.0.85 lib/knj/knj.rb
knjrbfw-0.0.84 lib/knj/knj.rb
knjrbfw-0.0.83 lib/knj/knj.rb
knjrbfw-0.0.82 lib/knj/knj.rb
knjrbfw-0.0.81 lib/knj/knj.rb
knjrbfw-0.0.80 lib/knj/knj.rb
knjrbfw-0.0.79 lib/knj/knj.rb
knjrbfw-0.0.78 lib/knj/knj.rb
knjrbfw-0.0.77 lib/knj/knj.rb