This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' | |
| require 'resourceful' | |
| require 'json' | |
| gem 'dm-core', '>=0.9.3' | |
| module DataMapper | |
| module Adapters | |
| class SsbeAdapter < AbstractAdapter | |
| def initialize(name, uri_or_options) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % /usr/local/bin/rbx test.rb | |
| A syntax error has occured: | |
| /usr/local/lib/rubinius/gems/1.8/gems/extlib-0.9.4/lib/extlib/lazy_array.rb:24: syntax error, unexpected ',', expecting '=' | |
| near line /usr/local/lib/rubinius/gems/1.8/gems/extlib-0.9.4/lib/extlib/lazy_array.rb:24, column 28 | |
| Code: | |
| @array.total=(*args, &block) | |
| ^ | |
| Backtrace: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Foo | |
| class_eval <<-EOS, __FILE__, __LINE__ | |
| def bar=(*args, &block) | |
| puts args.inspect | |
| end | |
| EOS | |
| end | |
| Foo.new.bar= 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % cat evaltest.rb | |
| class Zoo | |
| def bar=(a) | |
| puts a.inspect | |
| end | |
| end | |
| class Foo | |
| def initialize |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' | |
| require 'dm-core' | |
| require 'dm-types' | |
| require 'pathname' | |
| require Pathname(__FILE__).dirname + 'lib/active_resource_adapter' | |
| DataMapper.setup(:default, :adapter => :active_resource, :site => "http://localhost:3000/") | |
| class Person | |
| include DataMapper::Resource |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' | |
| require 'httpauth' | |
| require 'addressable/uri' | |
| class SSBEAuthenticator | |
| attr_reader :username, :password, :realm, :domain, :challenge | |
| def initialize(username, password) | |
| @username, @password = username, password |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| migration( 1, :convert_active_record_users ) do | |
| up do | |
| Users.all(:orm => 'active_record').each do |u| | |
| u.orm = 'datamapper' | |
| u.save | |
| end | |
| end | |
| end | |
| migrate_up! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <people> | |
| <person> | |
| <name>Paul</name> | |
| <addresses> | |
| <address> | |
| <city>Boulder</city> | |
| <state>Colorado</state> | |
| </address> | |
| </addresses> | |
| </person> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require File.join(File.dirname(__FILE__), '..', 'spec_helper.rb') | |
| describe Templates, "index action" do | |
| before :all do | |
| create_template_xml 'simple', <<-"XML" | |
| <template name="simple" description="The simplest template possible" /> | |
| XML | |
| end | |
| before do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| You can specify how many times you want to run the benchmarks with rake:perf x=(number) | |
| Some tasks will be run 10 and 1000 times less than (number) | |
| Benchmarks will now run 10000 times | |
| | DM 0.9.4 | AR 2.1 | DIFF | | |
| -------------------------------------------------------------------------------- | |
| Model.get specific (not cached) x10000 | 29.548 | 15.131 | 1.95x | | |
| Model.get specific (cached) x10000 | 1.573 | 15.245 | 0.10x | | |
| Model.first x10000 | 22.623 | 14.991 | 1.51x | | |
| Model.all limit(100) x1000 | 28.172 | 31.094 | 0.91x | | |
| Model.all limit(10,000) x10 | 26.626 | 33.923 | 0.78x | |
OlderNewer