Class: PopulateEnv::Formatters::EnvShellSection
- Inherits:
-
Object
- Object
- PopulateEnv::Formatters::EnvShellSection
- Defined in:
- lib/populate_env/formatters/env_shell_section.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
Instance Method Summary collapse
-
#initialize(attribute) ⇒ EnvShellSection
constructor
A new instance of EnvShellSection.
- #to_s ⇒ Object
Constructor Details
#initialize(attribute) ⇒ EnvShellSection
Returns a new instance of EnvShellSection.
6 7 8 |
# File 'lib/populate_env/formatters/env_shell_section.rb', line 6 def initialize(attribute) @attribute = attribute end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
4 5 6 |
# File 'lib/populate_env/formatters/env_shell_section.rb', line 4 def attribute @attribute end |
Instance Method Details
#to_s ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/populate_env/formatters/env_shell_section.rb', line 10 def to_s output = '' if attribute.description attribute.description.each_line do |line| output << "# #{line}\n" end end if attribute.optional? && attribute.value.nil? output << "# " end output << "#{attribute.name}=#{attribute.value}\n" end |