Class: Attach::AttachmentDSL
- Inherits:
-
Object
- Object
- Attach::AttachmentDSL
- Defined in:
- lib/attach/attachment_dsl.rb
Instance Attribute Summary collapse
-
#processors ⇒ Object
readonly
Returns the value of attribute processors.
-
#validators ⇒ Object
readonly
Returns the value of attribute validators.
Instance Method Summary collapse
-
#initialize(&block) ⇒ AttachmentDSL
constructor
A new instance of AttachmentDSL.
- #processor(*processors, &block) ⇒ Object
- #validator(*validators, &block) ⇒ Object
Constructor Details
#initialize(&block) ⇒ AttachmentDSL
Returns a new instance of AttachmentDSL.
8 9 10 11 12 |
# File 'lib/attach/attachment_dsl.rb', line 8 def initialize(&block) @processors = [] @validators = [] instance_eval(&block) if block_given? end |
Instance Attribute Details
#processors ⇒ Object (readonly)
Returns the value of attribute processors.
6 7 8 |
# File 'lib/attach/attachment_dsl.rb', line 6 def processors @processors end |
#validators ⇒ Object (readonly)
Returns the value of attribute validators.
6 7 8 |
# File 'lib/attach/attachment_dsl.rb', line 6 def validators @validators end |
Instance Method Details
#processor(*processors, &block) ⇒ Object
14 15 16 17 |
# File 'lib/attach/attachment_dsl.rb', line 14 def processor(*processors, &block) processors.each { |p| @processors << p } @processors << block if block_given? end |
#validator(*validators, &block) ⇒ Object
19 20 21 22 |
# File 'lib/attach/attachment_dsl.rb', line 19 def validator(*validators, &block) validators.each { |v| @validators << v } @validators << block if block_given? end |