Class: SourceMonitor::Setup::Requirements::Adapter
- Inherits:
-
Object
- Object
- SourceMonitor::Setup::Requirements::Adapter
- Defined in:
- lib/source_monitor/setup/requirements.rb
Instance Attribute Summary collapse
-
#expected ⇒ Object
readonly
Returns the value of attribute expected.
Instance Method Summary collapse
-
#initialize(expected) ⇒ Adapter
constructor
A new instance of Adapter.
- #normalize(value) ⇒ Object
- #satisfied?(value) ⇒ Boolean
Constructor Details
#initialize(expected) ⇒ Adapter
Returns a new instance of Adapter.
37 38 39 |
# File 'lib/source_monitor/setup/requirements.rb', line 37 def initialize(expected) @expected = expected.to_s end |
Instance Attribute Details
#expected ⇒ Object (readonly)
Returns the value of attribute expected.
35 36 37 |
# File 'lib/source_monitor/setup/requirements.rb', line 35 def expected @expected end |
Instance Method Details
#normalize(value) ⇒ Object
41 42 43 |
# File 'lib/source_monitor/setup/requirements.rb', line 41 def normalize(value) value&.to_s end |
#satisfied?(value) ⇒ Boolean
45 46 47 48 49 |
# File 'lib/source_monitor/setup/requirements.rb', line 45 def satisfied?(value) return false if value.blank? value.to_s.casecmp(expected).zero? end |