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
217 218 219 220 221 |
# File 'lib/nginxtra/config_converter.rb', line 217 def initialize(indentation, output) @indentation = indentation @output = output @tokens = [] end |
Instance Method Details
#<<(token) ⇒ Object
223 224 225 |
# File 'lib/nginxtra/config_converter.rb', line 223 def <<(token) @tokens << token end |
#empty? ⇒ Boolean
227 228 229 |
# File 'lib/nginxtra/config_converter.rb', line 227 def empty? @tokens.empty? end |
#puts ⇒ Object
235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/nginxtra/config_converter.rb', line 235 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.new "Can't puts invalid line!" end end |
#terminated? ⇒ Boolean
231 232 233 |
# File 'lib/nginxtra/config_converter.rb', line 231 def terminated? @tokens.last.terminal_character? end |