Class: Doctrine::Definition
- Inherits:
-
Object
- Object
- Doctrine::Definition
- Includes:
- Is::Stateful
- Defined in:
- lib/doctrine/definition.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#assert ⇒ Object
[public].
-
#capture ⇒ Object
[public].
-
#subject(value = value_omitted = true, &block) ⇒ Object
[public].
Class Method Details
.subject(value = value_omitted = true, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/doctrine/definition.rb', line 10 def subject(value = value_omitted = true, &block) if block @subject = block @subject_type = :block elsif !value_omitted @subject = value @subject_type = :value end end |
Instance Method Details
#assert ⇒ Object
- public
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/doctrine/definition.rb', line 42 def assert subject, subject_type = find_subject_and_subject_type if subject_type unless yield(resolve(subject, subject_type)) raise AssertionFailed end else raise UndefinedSubject end end |
#capture ⇒ Object
- public
56 57 58 59 60 61 |
# File 'lib/doctrine/definition.rb', line 56 def capture yield rescue => error @subject_type = :error @subject = error end |
#subject(value = value_omitted = true, &block) ⇒ Object
- public
30 31 32 33 34 35 36 37 38 |
# File 'lib/doctrine/definition.rb', line 30 def subject(value = value_omitted = true, &block) if block @subject = block @subject_type = :block elsif !value_omitted @subject = value @subject_type = :value end end |