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 Cachable | |
def self.included(receiver) | |
receiver.class_attribute :cachable | |
receiver.cachable = Keystore.new | |
receiver.send(:helper_method, :cachable) | |
end | |
class Keystore | |
def define name, &block | |
(class << self; self; end).send :define_method, name, &block |
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
u := Usine clone | |
u declare("user", user, | |
user firstname := "John" | |
user lastname := "Connor" | |
user age := suite(a, a+2) | |
) |
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
Usine := Object clone do ( | |
/* (...) */ | |
declare := method (factory, | |
object := Object clone | |
call sender setSlot(call argAt(1) name, object) | |
call sender appendProto(DummyObject) | |
call evalArgAt(2) | |
factories setSlot(factory,object) | |
) |
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
Usine := Object clone do ( | |
/* (...) */ | |
create := method (factory, | |
dummy := factories getSlot(factory) clone | |
parentProto := dummy protos first | |
parentProto slotNames foreach(slotName, | |
value := nil | |
if(parentProto getSlot(slotName) type == "Suite", | |
if(suites getSlot(slotName), |
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
Factory.define(:user) do |u| | |
u.firstname "John" | |
u.lastname "Connor" | |
u.sequence(:age) { |i| i ] | |
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
u := Usine clone | |
u declare("user", user, | |
user firstname := "John" | |
user lastname := "Connor" | |
user age := suite(a, a+2) | |
) | |
a := u create("user") | |
b := u create("user") |
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
Usine := Object clone do ( | |
DummyObject := Object clone do ( | |
Suite := Object clone do ( | |
variantName := nil | |
bodyBlock := nil | |
eval := method(x, | |
context := Object clone | |
context setSlot(variantName, x) |
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.expand_path(File.dirname(__FILE__) + '/../spec_helper') | |
describe Snapshot do | |
before(:each) do | |
@observer = PretendObserver.new(@string_io = StringIO.new("","w")) | |
end | |
it "should create a snapshot ready to be applied" do | |
Snapshot.new(:size => "4G", :path => '/dev/vg00/pwet-disk', :name => 'pwet') | |
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
# Autocomplete handler for all core controllers. | |
#---------------------------------------------------------------------------- | |
def auto_complete | |
@query = params[:auto_complete_query] | |
@auto_complete = hook(:auto_complete, self, :query => @query, :user => @current_user) | |
if @auto_complete.empty? | |
@auto_complete = self.controller_name.classify.constantize.my(:user => @current_user, :limit => 10).search(@query) | |
else | |
@auto_complete = @auto_complete.last | |
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 Keywordable | |
module ClassMethods | |
def keyword(symbol, proc) | |
write_inheritable_attribute :keywords, {} unless read_inheritable_attribute :keywords | |
read_inheritable_attribute(:keywords)[symbol] = proc | |
end | |
end | |
module InstanceMethods | |
def keywords |