Skip to content

Instantly share code, notes, and snippets.

View jackdempsey's full-sized avatar

jack dempsey jackdempsey

View GitHub Profile
unless File.exists?('src')
puts "Creating merb dir..."
FileUtils.mkdir("merb")
end
FileUtils.cd("src")
Last login: Tue Sep 2 21:05:10 on ttys000
~ $ irb
irb(main):001:0> module Foo
irb(main):002:1> def self.bar
irb(main):003:2> puts 'here in bar'
irb(main):004:2> end
irb(main):005:1> end
=> nil
irb(main):006:0> class Bar
irb(main):007:1> include Foo
class Test < Application
# ...and remember, everything returned from an action
# goes to the client...
def index
if true
return redirect url(:action => 'foo')
else
'no go'
end
diff --git a/merb_datamapper/lib/merb_datamapper/merbtasks.rb b/merb_datamapper/lib/merb_datamapper/merbtasks.rb
index 20452c3..3037d7b 100644
--- a/merb_datamapper/lib/merb_datamapper/merbtasks.rb
+++ b/merb_datamapper/lib/merb_datamapper/merbtasks.rb
@@ -48,13 +48,17 @@ namespace :dm do
desc "Migrate the database to the latest version"
task :migrate => 'dm:db:migrate:up'
- desc "Create the database (postgres only)"
+ desc "Create the database"
class Gists < Application
provides :json
def index
@gists = Gist.all
display @gists
end
def show
@gist = Gist.get(params[:id])
~/git/thor (constants)$ irb
>> require 'thor'
=> true
>> Thor
=> Thor
>> Thor.constants
=> ["OrderedHash", "Util", "TaskHash", "Options", "Error", "Task"]
>> Thor::TaskHash.constants
=> ["Node"]
>> Thor::TaskHash::Node.constants
>> object = Struct.new(:example)
=> #<Class:0x231d3f8>
>> object.constants
=> ["Group", "Passwd", "Tms"]
>> object::Group.constants
=> ["Group", "Passwd", "Tms"]
>> object::Group::Group.constants
=> ["Group", "Passwd", "Tms"]
>>
~/.thor $ irb
irb(main):001:0> Node = Struct.new(:node)
=> Node
irb(main):002:0> Node.constants
=> ["Tms"]
irb(main):003:0> Node::Tms.constants
=> ["Tms"]
irb(main):004:0> Node::Tms::Tms.constants
=> ["Tms"]
/usr/local/lib/ruby/gems/1.8/gems $ irb
irb(main):001:0> require 'spec/rake/spectask'
LoadError: no such file to load -- spec/rake/spectask
from (irb):1:in `require'
from (irb):1
from :0
irb(main):002:0> require 'rubygems'
=> true
irb(main):003:0> require 'spec/rake/spectask'
=> true
~/git/self-deprecated master$ irb
irb(main):001:0> class Foo; end
=> nil
irb(main):002:0> class A < Foo; end
=> nil
irb(main):003:0> class B; end
=> nil
irb(main):004:0> class A < B; end
TypeError: superclass mismatch for class A
from (irb):4