Class: Nginxtra::ConfigConverter::Line
- Inherits:
-
Object
- Object
- Nginxtra::ConfigConverter::Line
- Defined in:
- lib/nginxtra/config_converter.rb
Instance Method Summary collapse
- #<<(token) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(indentation, output) ⇒ Line
constructor
A new instance of Line.
- #puts ⇒ Object
- #terminated? ⇒ Boolean
Constructor Details
#initialize(indentation, output) ⇒ Line
Returns a new instance of Line.
224 225 226 227 228 |
# File 'lib/nginxtra/config_converter.rb', line 224 def initialize(indentation, output) @indentation = indentation @output = output @tokens = [] end |
Instance Method Details
#<<(token) ⇒ Object
230 231 232 |
# File 'lib/nginxtra/config_converter.rb', line 230 def <<(token) @tokens << token end |
#empty? ⇒ Boolean
234 235 236 |
# File 'lib/nginxtra/config_converter.rb', line 234 def empty? @tokens.empty? end |
#puts ⇒ Object
242 243 244 245 246 247 248 249 250 251 252 |
# File 'lib/nginxtra/config_converter.rb', line 242 def puts if @tokens.last.end? puts_line elsif @tokens.last.block_start? puts_block_start elsif @tokens.last.block_end? puts_block_end else raise Nginxtra::Error::ConvertFailed, "Can't puts invalid line!" end end |
#terminated? ⇒ Boolean
238 239 240 |
# File 'lib/nginxtra/config_converter.rb', line 238 def terminated? @tokens.last.terminal_character? end |