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 | |
| def self.define_attribute(name) | |
| class_eval %{ | |
| def #{name}(*args) | |
| attribute(#{name.inspect}, *args) | |
| 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
| # Ported from https://github.com/jzaefferer/jquery-validation/blob/master/jquery.validate.js | |
| creditcard = (value)-> | |
| # accept only spaces, digits and dashes | |
| return unless /[^0-9 \-]+/.test(value) | |
| nCheck = nDigit = 0 | |
| bEven = false | |
| checkDigit = (n) -> |