Class: Straitjacket
- Inherits:
-
Object
- Object
- Straitjacket
- Defined in:
- lib/straitjacket.rb
Defined Under Namespace
Classes: CheckConstraint, Constraint, DeprecatedConstraint, Error, ForeignKeyConstraint, Proxy
Instance Attribute Summary collapse
-
#constraints ⇒ Object
readonly
Returns the value of attribute constraints.
Instance Method Summary collapse
- #apply(conn) ⇒ Object
-
#initialize(&block) ⇒ Straitjacket
constructor
A new instance of Straitjacket.
- #on(table, &block) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Straitjacket
Returns a new instance of Straitjacket.
52 53 54 55 56 |
# File 'lib/straitjacket.rb', line 52 def initialize(&block) @constraints = [] @names = {} instance_eval(&block) if block end |
Instance Attribute Details
#constraints ⇒ Object (readonly)
Returns the value of attribute constraints.
50 51 52 |
# File 'lib/straitjacket.rb', line 50 def constraints @constraints end |
Instance Method Details
#apply(conn) ⇒ Object
58 59 60 |
# File 'lib/straitjacket.rb', line 58 def apply(conn) constraints.map{|c| c.apply(conn) } end |