Class: RTPush::BaseAdapter
- Inherits:
-
Object
- Object
- RTPush::BaseAdapter
show all
- Defined in:
- lib/rtpush/adapters/base_adapter.rb
Constant Summary
collapse
- @@_validators =
[]
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of BaseAdapter.
6
7
8
|
# File 'lib/rtpush/adapters/base_adapter.rb', line 6
def initialize
@errors = []
end
|
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
3
4
5
|
# File 'lib/rtpush/adapters/base_adapter.rb', line 3
def errors
@errors
end
|
Class Method Details
.validates_existence_of(attribute) ⇒ Object
14
15
16
|
# File 'lib/rtpush/adapters/base_adapter.rb', line 14
def self.validates_existence_of(attribute)
@@_validators << PresenceValidator.new(attribute)
end
|
.validates_presence_of(attribute) ⇒ Object
10
11
12
|
# File 'lib/rtpush/adapters/base_adapter.rb', line 10
def self.validates_presence_of(attribute)
@@_validators << PresenceValidator.new(attribute)
end
|
Instance Method Details
#exist? ⇒ Boolean
25
26
27
28
29
30
|
# File 'lib/rtpush/adapters/base_adapter.rb', line 25
def exist?
@@_validators.each do |v|
v.exist(self)
end
@errors.empty?
end
|
#valid? ⇒ Boolean
18
19
20
21
22
23
|
# File 'lib/rtpush/adapters/base_adapter.rb', line 18
def valid?
@@_validators.each do |v|
v.validate(self)
end
@errors.empty?
end
|