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
| (function($) { | |
| $.fn.myPlugin = function(options, args){ | |
| this.each(function(){ | |
| $this = $(this); | |
| var instance = $this.data('myPlugin'); | |
| if (instance && typeof(instance) == 'object') | |
| callInstance(instance, options, args); | |
| else |
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 'sequel' | |
| DB = Sequel.sqlite | |
| DB.create_table :models do | |
| primary_key :id | |
| column :first_attr, :fixnum | |
| column :second_attr, :string |
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 Base | |
| module InstanceMethods | |
| alias_method :model, :class | |
| end | |
| end | |
| class Model | |
| include Base::InstanceMethods | |
| 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
| irb(main):001:0> require 'rubygems' | |
| => true | |
| irb(main):002:0> require 'sequel' | |
| => true | |
| irb(main):003:0> DB = Sequel.sqlite | |
| => #<Sequel::SQLite::Database: "sqlite:/"> | |
| irb(main):004:0> DB.create_table :items do | |
| irb(main):005:1> primary_key :id | |
| irb(main):006:1> String :title | |
| irb(main):007:0> end |
NewerOlder