Class: Nginxtra::ConfigConverter::Line

Inherits:
Object
  • Object
show all
Defined in:
lib/nginxtra/config_converter.rb

Instance Method Summary collapse

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

#putsObject



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