BasicObject
# File lib/ramaze/spec/bacon.rb, line 37 def app; Ramaze.middleware; end
Defines an instance method within a class
# File lib/ramaze/snippets/metaid.rb, line 14 def class_def name, &blk class_eval { define_method name, &blk } end
Adds methods to a metaclass
# File lib/ramaze/snippets/metaid.rb, line 9 def meta_def name, &blk meta_eval { define_method name, &blk } end
# File lib/ramaze/snippets/metaid.rb, line 6 def meta_eval &blk; metaclass.instance_eval(&blk); end
The hidden singleton lurks behind everyone
# File lib/ramaze/snippets/metaid.rb, line 5 def metaclass; class << self; self; end; end
# File lib/ramaze/spec/bacon.rb, line 18 def spec_precondition(name) yield rescue LoadError => ex puts "Spec require: %p failed: %p" % [name, ex.message] exit 0 rescue Exception => ex puts "Spec precondition: %p failed: %p" % [name, ex.message] exit 0 end
# File lib/ramaze/spec/bacon.rb, line 11 def spec_requires(*libs) spec_precondition 'require' do libs.each { |lib| require(lib) } end end
# File lib/ramaze/spec/helper/template_examples.rb, line 7 def spec_template(spec_engine) it 'works on /' do get('/').body.strip. should =~ %{<a href\s*=\s*"/">Home</a>\s+\|\s+<a href\s*=\s*"/internal">internal</a>\s+\|\s+<a href\s*=\s*"/external">external</a>} end ]/internal /external].each do |url| it "works on #{url}" do html = get(url).body html.should.not == nil html.should =~ %{<title>Template::#{spec_engine} (internal|external)</title>} html.should =~ %{<h1>The (internal|external) Template for #{spec_engine}</h1>} end end end
Generated with the Darkfish Rdoc Generator 2.