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

Version Path
mongomodel-0.2.20 bin/console
mongomodel-0.2.19 bin/console
mongomodel-0.2.18 bin/console
mongomodel-0.2.17 bin/console
mongomodel-0.2.16 bin/console
mongomodel-0.2.15 bin/console
mongomodel-0.2.14 bin/console
mongomodel-0.2.13 bin/console
mongomodel-0.2.12 bin/console
mongomodel-0.2.11 bin/console
mongomodel-0.2.10 bin/console
mongomodel-0.2.9 bin/console