Class: Dri::FeatureFlagReport
- Inherits:
-
Object
- Object
- Dri::FeatureFlagReport
- Includes:
- Utils::Constants::FeatureFlag::Labels
- Defined in:
- lib/dri/feature_flag_report.rb
Constant Summary
Constants included from Utils::Constants::FeatureFlag::Labels
Utils::Constants::FeatureFlag::Labels::PREPROD, Utils::Constants::FeatureFlag::Labels::PRODUCTION, Utils::Constants::FeatureFlag::Labels::STAGING, Utils::Constants::FeatureFlag::Labels::STAGING_REF
Instance Attribute Summary collapse
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#labels ⇒ Object
readonly
Returns the value of attribute labels.
-
#preprod ⇒ Object
readonly
Returns the value of attribute preprod.
-
#prod ⇒ Object
readonly
Returns the value of attribute prod.
-
#staging ⇒ Object
readonly
Returns the value of attribute staging.
-
#staging_ref ⇒ Object
readonly
Returns the value of attribute staging_ref.
Instance Method Summary collapse
- #add_change(feature_flag) ⇒ Object
- #get_all_flag_changes ⇒ Object
-
#initialize ⇒ FeatureFlagReport
constructor
A new instance of FeatureFlagReport.
Constructor Details
#initialize ⇒ FeatureFlagReport
Returns a new instance of FeatureFlagReport.
11 12 13 14 15 16 17 18 |
# File 'lib/dri/feature_flag_report.rb', line 11 def initialize @header = '## Feature Flag Changes' @labels = %w[Summary Changed(UTC) URL] @prod = [] @staging = [] @staging_ref = [] @preprod = [] end |
Instance Attribute Details
#header ⇒ Object (readonly)
Returns the value of attribute header.
9 10 11 |
# File 'lib/dri/feature_flag_report.rb', line 9 def header @header end |
#labels ⇒ Object (readonly)
Returns the value of attribute labels.
9 10 11 |
# File 'lib/dri/feature_flag_report.rb', line 9 def labels @labels end |
#preprod ⇒ Object (readonly)
Returns the value of attribute preprod.
9 10 11 |
# File 'lib/dri/feature_flag_report.rb', line 9 def preprod @preprod end |
#prod ⇒ Object (readonly)
Returns the value of attribute prod.
9 10 11 |
# File 'lib/dri/feature_flag_report.rb', line 9 def prod @prod end |
#staging ⇒ Object (readonly)
Returns the value of attribute staging.
9 10 11 |
# File 'lib/dri/feature_flag_report.rb', line 9 def staging @staging end |
#staging_ref ⇒ Object (readonly)
Returns the value of attribute staging_ref.
9 10 11 |
# File 'lib/dri/feature_flag_report.rb', line 9 def staging_ref @staging_ref end |
Instance Method Details
#add_change(feature_flag) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/dri/feature_flag_report.rb', line 20 def add_change(feature_flag) summary = feature_flag.title changed_on = feature_flag.description[/(?<=Changed on \(in UTC\): ).+?(?=\n)/].delete('`') url = feature_flag.web_url feature_flag_data = [summary, changed_on, url] labels = feature_flag.labels host_label = labels.select { |label| /^host::/.match(label) }.join case host_label when PRODUCTION @prod << feature_flag_data when STAGING @staging << feature_flag_data when STAGING_REF @staging_ref << feature_flag_data when PREPROD @preprod << feature_flag_data end end |
#get_all_flag_changes ⇒ Object
43 44 45 |
# File 'lib/dri/feature_flag_report.rb', line 43 def get_all_flag_changes { production: @prod, staging: @staging, staging_ref: @staging_ref, preprod: @preprod } end |