Module: Roll::Attributes
- Included in:
- Package, Package::Contents, Package::Control, Package::Security, Package::Version
- Defined in:
- lib/roll/attributes.rb
Overview
Attributes DSL
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #valid? ⇒ Boolean
- #validate ⇒ Object (also: #assert_valid)
Class Method Details
.included(base) ⇒ Object
6 7 8 |
# File 'lib/roll/attributes.rb', line 6 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#valid? ⇒ Boolean
11 12 13 14 15 16 17 18 |
# File 'lib/roll/attributes.rb', line 11 def valid? begin validate return true rescue ValidationError return false end end |
#validate ⇒ Object Also known as: assert_valid
21 22 23 24 25 |
# File 'lib/roll/attributes.rb', line 21 def validate self.class.validation.each do |, block| raise(ValidationError, ) unless instance_eval(&block) end end |