Class: Ec2ssh::SshConfig::Section
- Inherits:
-
Object
- Object
- Ec2ssh::SshConfig::Section
- Defined in:
- lib/ec2ssh/ssh_config.rb
Constant Summary collapse
- HEADER =
"# section:"
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
- #append(text) ⇒ Object
-
#initialize(name, text = '') ⇒ Section
constructor
A new instance of Section.
- #replace!(text) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name, text = '') ⇒ Section
Returns a new instance of Section.
83 84 85 86 |
# File 'lib/ec2ssh/ssh_config.rb', line 83 def initialize(name, text = '') @name = name @text = text end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
80 81 82 |
# File 'lib/ec2ssh/ssh_config.rb', line 80 def name @name end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
81 82 83 |
# File 'lib/ec2ssh/ssh_config.rb', line 81 def text @text end |
Instance Method Details
#append(text) ⇒ Object
88 89 90 |
# File 'lib/ec2ssh/ssh_config.rb', line 88 def append(text) @text << text end |
#replace!(text) ⇒ Object
92 93 94 |
# File 'lib/ec2ssh/ssh_config.rb', line 92 def replace!(text) @text = text end |
#to_s ⇒ Object
96 97 98 99 100 101 102 103 104 105 |
# File 'lib/ec2ssh/ssh_config.rb', line 96 def to_s if text.empty? "" else "\#{HEADER} \#{@name}\n\#{@text}\n EOS\n end\nend\n" |