Class: Shoulda::Matchers::ActiveModel::RequireAValidSubnetMatcher
- Inherits:
-
ValidationMatcher
- Object
- ValidationMatcher
- Shoulda::Matchers::ActiveModel::RequireAValidSubnetMatcher
- Defined in:
- lib/validates_host/require_a_valid_subnet_matcher.rb
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(attribute) ⇒ RequireAValidSubnetMatcher
constructor
A new instance of RequireAValidSubnetMatcher.
- #matches?(subject) ⇒ Boolean
Constructor Details
#initialize(attribute) ⇒ RequireAValidSubnetMatcher
Returns a new instance of RequireAValidSubnetMatcher.
11 12 13 |
# File 'lib/validates_host/require_a_valid_subnet_matcher.rb', line 11 def initialize(attribute) @attribute = attribute end |
Instance Method Details
#description ⇒ Object
15 16 17 |
# File 'lib/validates_host/require_a_valid_subnet_matcher.rb', line 15 def description "require #{@attribute} to be a valid subnet" end |
#matches?(subject) ⇒ Boolean
19 20 21 22 23 |
# File 'lib/validates_host/require_a_valid_subnet_matcher.rb', line 19 def matches?(subject) super(subject) disallows_invalid_value and allows_valid_value end |