Sha256: f5b02fcee8381873df118c45c23de2110070011412296617940829c365b1ed27
Contents?: true
Size: 862 Bytes
Versions: 12
Compression:
Stored size: 862 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' 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
12 entries across 12 versions & 1 rubygems