Sha256: 2921bab865def4e16797b010c83e53dcb04c436187d338df7424f15fe22898af
Contents?: true
Size: 925 Bytes
Versions: 14
Compression:
Stored size: 925 Bytes
Contents
#!/usr/bin/env ruby puts "Loading MongoModel sandbox..." require "rubygems" require "bundler/setup" $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib') require 'irb' require 'irb/completion' require 'mongomodel' MongoModel.logger = ActiveSupport::BufferedLogger.new(STDERR) IRB.setup(nil) IRB.conf[:USE_READLINE] = true IRB.conf[:PROMPT_MODE] = :SIMPLE irb = IRB::Irb.new IRB.conf[:MAIN_CONTEXT] = irb.context examples = <<-EXAMPLES class Article < MongoModel::Document property :title, String, :required => true property :published, Boolean, :default => false timestamps! default_scope order(:title.asc) scope :published, where(:published => true) scope :latest, lambda { |num| order(:created_at.desc).limit(num) } end EXAMPLES puts examples irb.context.evaluate(examples, 0) trap("SIGINT") do irb.signal_handle end catch(:IRB_EXIT) do irb.eval_input end
Version data entries
14 entries across 14 versions & 1 rubygems