Class: DataMapper::Is::Temporal::PropertyHelper
- Inherits:
-
Object
- Object
- DataMapper::Is::Temporal::PropertyHelper
- Defined in:
- lib/dm-is-temporal/is/temporal.rb
Instance Method Summary collapse
- #__has__ ⇒ Object
- #__properties__ ⇒ Object
- #after(*args, &block) ⇒ Object
- #before(*args, &block) ⇒ Object
- #belongs_to(*args) ⇒ Object
- #has(multiplicity, *args) ⇒ Object
-
#initialize(base) ⇒ PropertyHelper
constructor
A new instance of PropertyHelper.
- #n ⇒ Object
- #property(*args) ⇒ Object
Constructor Details
#initialize(base) ⇒ PropertyHelper
Returns a new instance of PropertyHelper.
7 8 9 10 11 12 13 |
# File 'lib/dm-is-temporal/is/temporal.rb', line 7 def initialize(base) @__properties__ = [] @__has__ = [] @__base__ = base @__before__ = [] @__after__ = [] end |
Instance Method Details
#__has__ ⇒ Object
46 47 48 |
# File 'lib/dm-is-temporal/is/temporal.rb', line 46 def __has__ @__has__ end |
#__properties__ ⇒ Object
42 43 44 |
# File 'lib/dm-is-temporal/is/temporal.rb', line 42 def __properties__ @__properties__ end |
#after(*args, &block) ⇒ Object
23 24 25 |
# File 'lib/dm-is-temporal/is/temporal.rb', line 23 def after(*args, &block) @__after__ << [args, block] end |
#before(*args, &block) ⇒ Object
19 20 21 |
# File 'lib/dm-is-temporal/is/temporal.rb', line 19 def before(*args, &block) @__before__ << [args, block] end |
#belongs_to(*args) ⇒ Object
34 35 36 |
# File 'lib/dm-is-temporal/is/temporal.rb', line 34 def belongs_to(*args) raise 'Temporal associations are not supported yet!' end |
#has(multiplicity, *args) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/dm-is-temporal/is/temporal.rb', line 27 def has(multiplicity, *args) opts = args.last.is_a?(Hash) ? args.pop : {} name = args.shift raise "Associations :through option is not yet supported!" if opts[:through] @__has__ << [multiplicity, name, args, opts] end |
#n ⇒ Object
38 39 40 |
# File 'lib/dm-is-temporal/is/temporal.rb', line 38 def n nil end |
#property(*args) ⇒ Object
15 16 17 |
# File 'lib/dm-is-temporal/is/temporal.rb', line 15 def property(*args) @__properties__ << args end |