Class: Code42::AttributeSerializerExceptions
- Inherits:
-
Object
- Object
- Code42::AttributeSerializerExceptions
- Includes:
- Enumerable
- Defined in:
- lib/code42/attribute_serializer.rb
Instance Method Summary collapse
- #<<(exception) ⇒ Object
- #each(&block) ⇒ Object
- #from(value) ⇒ Object
-
#initialize(exceptions = []) ⇒ AttributeSerializerExceptions
constructor
A new instance of AttributeSerializerExceptions.
- #to(value) ⇒ Object
Constructor Details
#initialize(exceptions = []) ⇒ AttributeSerializerExceptions
101 102 103 |
# File 'lib/code42/attribute_serializer.rb', line 101 def initialize(exceptions = []) @exceptions = exceptions end |
Instance Method Details
#<<(exception) ⇒ Object
105 106 107 |
# File 'lib/code42/attribute_serializer.rb', line 105 def <<(exception) @exceptions << exception end |
#each(&block) ⇒ Object
117 118 119 120 121 122 123 124 125 |
# File 'lib/code42/attribute_serializer.rb', line 117 def each(&block) @exceptions.each do |exception| if block_given? block.call exception else yield exception end end end |
#from(value) ⇒ Object
109 110 111 |
# File 'lib/code42/attribute_serializer.rb', line 109 def from(value) detect { |e| e.from == value } end |
#to(value) ⇒ Object
113 114 115 |
# File 'lib/code42/attribute_serializer.rb', line 113 def to(value) detect { |e| e.to == value } end |