Class: ReleaseFeature::Feature
- Inherits:
-
Object
- Object
- ReleaseFeature::Feature
- Defined in:
- lib/release_feature/feature.rb
Instance Attribute Summary collapse
-
#close_at ⇒ Object
readonly
Returns the value of attribute close_at.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#open_at ⇒ Object
readonly
Returns the value of attribute open_at.
Instance Method Summary collapse
-
#initialize(name:, environment:, open_at:, close_at:) ⇒ Feature
constructor
A new instance of Feature.
- #permitted?(current_time) ⇒ TrueClass, FalseClass
Constructor Details
#initialize(name:, environment:, open_at:, close_at:) ⇒ Feature
Returns a new instance of Feature.
11 12 13 14 15 16 17 18 |
# File 'lib/release_feature/feature.rb', line 11 def initialize(name:, environment:, open_at:, close_at:) validate_present({ name: name, environment: environment, open_at: open_at, close_at: close_at }) @name = cast_to_sym(:name, name) @environment = cast_to_sym(:environment, environment) @open_at = open_at @close_at = close_at raise ReleaseFeature::Error, unless valid? end |
Instance Attribute Details
#close_at ⇒ Object (readonly)
Returns the value of attribute close_at.
5 6 7 |
# File 'lib/release_feature/feature.rb', line 5 def close_at @close_at end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
5 6 7 |
# File 'lib/release_feature/feature.rb', line 5 def environment @environment end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
5 6 7 |
# File 'lib/release_feature/feature.rb', line 5 def errors @errors end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/release_feature/feature.rb', line 5 def name @name end |
#open_at ⇒ Object (readonly)
Returns the value of attribute open_at.
5 6 7 |
# File 'lib/release_feature/feature.rb', line 5 def open_at @open_at end |
Instance Method Details
#permitted?(current_time) ⇒ TrueClass, FalseClass
22 23 24 |
# File 'lib/release_feature/feature.rb', line 22 def permitted?(current_time) (open_at...close_at).cover?(current_time) end |