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
module DataMapper | |
class Property | |
class Textile < String | |
def load(value) | |
RedCloth.new(value.to_s).to_html | |
end | |
end | |
end | |
end |
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
git "git://github.com/datamapper/dm-more.git", :branch => 'next' | |
gem 'dm-validations', '~> 0.10.3' | |
gem 'dm-aggregates', '~> 0.10.3' | |
gem 'dm-timestamps', '~> 0.10.3' | |
gem 'dm-types', '~> 0.10.3' |
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
AbstractProperty: | |
public: | |
.accept_options | |
.accepted_options | |
.descendants | |
.options | |
.primitive | |
#allow_blank? | |
#allow_nil? |
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 'dm-core' | |
require 'dm-migrations' | |
require 'dm-types' | |
DataMapper.setup(:default, "mysql://localhost/dm_core_test") | |
class Heffalump | |
include DataMapper::Resource | |
property :id, UUID, :key => true, :default => lambda{UUIDTools::UUID.random_create} |
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/bin/env ruby -Ku | |
# encoding: utf-8 | |
require 'rubygems' | |
require 'dm-core' | |
require 'dm-migrations' | |
require 'dm-timestamps' | |
DataMapper.setup :default, 'sqlite3::memory:' |
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
source 'http://rubygems.org' | |
group :runtime do | |
# We bundle both AS and extlib while extlib compatibility needs to be kept around. | |
# require 'dm-core' will ensure that only one is activated at any time though. | |
# This is done by trying to require AS components and fallback to requiring | |
# extlib in case a LoadError was rescued when requiring AS code. | |
# | |
# Due to bundle exec activating all groups in the Gemfile, it's recommended to run |
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
#!/bin/bash | |
NAME="dm-types" | |
git clone --quiet --no-hardlinks dm-more $NAME | |
cd $NAME | |
git filter-branch --prune-empty --subdirectory-filter $NAME --tag-name-filter 'cat' -- --all |
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 Meta < DataMapper::Type | |
primitive ::Object | |
end | |
class User | |
include DataMapper::Resource | |
property :id, Serial | |
property :meta, Meta | |
end |
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
module DataMapper | |
class Property | |
# the primitive is Integer so we inherit from Property::Integer | |
# to get the common behavior (typecasting, validation checking etc.) | |
# and predefined options | |
class CheckedInteger < Integer | |
OPTIONS = [ :gt, :gte, :lte, :lt ] |
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 'dm-core' | |
DataMapper::Property::String.required true | |
class User | |
include DataMapper::Resource | |
property :id, Serial | |
property :name, String | |
end |