Class: Escort::Formatter::Option
- Inherits:
-
Object
- Object
- Escort::Formatter::Option
- Defined in:
- lib/escort/formatter/option.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#setup ⇒ Object
readonly
Returns the value of attribute setup.
Instance Method Summary collapse
- #conflicts ⇒ Object
- #dependencies ⇒ Object
- #description ⇒ Object
- #has_conflicts? ⇒ Boolean
- #has_dependencies? ⇒ Boolean
- #has_validations? ⇒ Boolean
-
#initialize(name, details, setup, context) ⇒ Option
constructor
A new instance of Option.
- #usage ⇒ Object
- #validations ⇒ Object
Constructor Details
#initialize(name, details, setup, context) ⇒ Option
Returns a new instance of Option.
6 7 8 9 10 11 |
# File 'lib/escort/formatter/option.rb', line 6 def initialize(name, details, setup, context) @name = name.to_sym @details = details @setup = setup @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
4 5 6 |
# File 'lib/escort/formatter/option.rb', line 4 def context @context end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
4 5 6 |
# File 'lib/escort/formatter/option.rb', line 4 def details @details end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/escort/formatter/option.rb', line 4 def name @name end |
#setup ⇒ Object (readonly)
Returns the value of attribute setup.
4 5 6 |
# File 'lib/escort/formatter/option.rb', line 4 def setup @setup end |
Instance Method Details
#conflicts ⇒ Object
25 26 27 |
# File 'lib/escort/formatter/option.rb', line 25 def conflicts has_conflicts? ? "conflicts with: #{conflicts_list.map{|option| "--#{option}"}.join(', ')}" : '' end |
#dependencies ⇒ Object
33 34 35 |
# File 'lib/escort/formatter/option.rb', line 33 def dependencies has_dependencies? ? "depends on: #{format_dependency_list(dependencies_list).join(', ')}" : '' end |
#description ⇒ Object
17 18 19 |
# File 'lib/escort/formatter/option.rb', line 17 def description [base_description_string, description_default_string].select{|item| !item.empty?}.join(" ") end |
#has_conflicts? ⇒ Boolean
21 22 23 |
# File 'lib/escort/formatter/option.rb', line 21 def has_conflicts? !conflicts_list.empty? end |
#has_dependencies? ⇒ Boolean
29 30 31 |
# File 'lib/escort/formatter/option.rb', line 29 def has_dependencies? !dependencies_list.empty? end |
#has_validations? ⇒ Boolean
37 38 39 |
# File 'lib/escort/formatter/option.rb', line 37 def has_validations? !validations_list.empty? end |
#usage ⇒ Object
13 14 15 |
# File 'lib/escort/formatter/option.rb', line 13 def usage [long_string, short_string, type_string].select{|item| !item.empty?}.join(" ") end |
#validations ⇒ Object
41 42 43 |
# File 'lib/escort/formatter/option.rb', line 41 def validations has_validations? ? : [] end |