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
7 8 9 10 11 12 13 |
# File 'lib/attach/attachment_dsl.rb', line 7 def initialize(&block) @processors = [] @validators = [] if block_given? instance_eval(&block) end end |
Instance Attribute Details
#processors ⇒ Object (readonly)
Returns the value of attribute processors.
4 5 6 |
# File 'lib/attach/attachment_dsl.rb', line 4 def processors @processors end |
#validators ⇒ Object (readonly)
Returns the value of attribute validators.
5 6 7 |
# File 'lib/attach/attachment_dsl.rb', line 5 def validators @validators end |
Instance Method Details
#processor(*processors, &block) ⇒ Object
15 16 17 18 |
# File 'lib/attach/attachment_dsl.rb', line 15 def processor(*processors, &block) processors.each { |p| @processors << p } @processors << block if block_given? end |
#validator(*validators, &block) ⇒ Object
20 21 22 23 |
# File 'lib/attach/attachment_dsl.rb', line 20 def validator(*validators, &block) validators.each { |v| @validators << v } @validators << block if block_given? end |