Class: MKBrut::AppOptions
- Inherits:
-
Object
- Object
- MKBrut::AppOptions
- Defined in:
- lib/mkbrut/app_options.rb
Instance Attribute Summary collapse
-
#app_id ⇒ Object
readonly
Returns the value of attribute app_id.
-
#app_name ⇒ Object
readonly
Returns the value of attribute app_name.
-
#demo ⇒ Object
readonly
Returns the value of attribute demo.
-
#organization ⇒ Object
readonly
Returns the value of attribute organization.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
-
#segments ⇒ Object
readonly
Returns the value of attribute segments.
-
#versions ⇒ Object
readonly
Returns the value of attribute versions.
Instance Method Summary collapse
- #demo? ⇒ Boolean
- #dry_run? ⇒ Boolean
-
#initialize(app_name:, app_id: nil, prefix: nil, dry_run: nil, organization: nil, demo: false, versions: nil, **rest) ⇒ AppOptions
constructor
A new instance of AppOptions.
Constructor Details
#initialize(app_name:, app_id: nil, prefix: nil, dry_run: nil, organization: nil, demo: false, versions: nil, **rest) ⇒ AppOptions
Returns a new instance of AppOptions.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/mkbrut/app_options.rb', line 4 def initialize( app_name:, app_id: nil, prefix: nil, dry_run: nil, organization: nil, demo: false, versions: nil, **rest ) if app_name.nil? raise ArgumentError, "app_name is required" end @app_name = app_name @app_id = app_id || MKBrut::AppId.from_app_name(@app_name) @prefix = prefix || MKBrut::Prefix.from_app_id(@app_id) @organization = organization || @app_id @dry_run = !!dry_run @demo = !!demo @versions = versions @segments = rest.map { |key,value| if key =~ /^segment-(.+)$/ && value $1 else nil end }.compact end |
Instance Attribute Details
#app_id ⇒ Object (readonly)
Returns the value of attribute app_id.
2 3 4 |
# File 'lib/mkbrut/app_options.rb', line 2 def app_id @app_id end |
#app_name ⇒ Object (readonly)
Returns the value of attribute app_name.
2 3 4 |
# File 'lib/mkbrut/app_options.rb', line 2 def app_name @app_name end |
#demo ⇒ Object (readonly)
Returns the value of attribute demo.
2 3 4 |
# File 'lib/mkbrut/app_options.rb', line 2 def demo @demo end |
#organization ⇒ Object (readonly)
Returns the value of attribute organization.
2 3 4 |
# File 'lib/mkbrut/app_options.rb', line 2 def organization @organization end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
2 3 4 |
# File 'lib/mkbrut/app_options.rb', line 2 def prefix @prefix end |
#segments ⇒ Object (readonly)
Returns the value of attribute segments.
2 3 4 |
# File 'lib/mkbrut/app_options.rb', line 2 def segments @segments end |
#versions ⇒ Object (readonly)
Returns the value of attribute versions.
2 3 4 |
# File 'lib/mkbrut/app_options.rb', line 2 def versions @versions end |
Instance Method Details
#demo? ⇒ Boolean
35 |
# File 'lib/mkbrut/app_options.rb', line 35 def demo? = @demo |
#dry_run? ⇒ Boolean
34 |
# File 'lib/mkbrut/app_options.rb', line 34 def dry_run? = @dry_run |