Class: Puppet::Pops::Types::StringConverter::Indentation Private

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/pops/types/string_converter.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API:

  • private

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(level, first, is_indenting) ⇒ Indentation

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Indentation.

API:

  • private



28
29
30
31
32
# File 'lib/puppet/pops/types/string_converter.rb', line 28

def initialize(level, first, is_indenting)
  @level = level
  @first = first
  @is_indenting = is_indenting
end

Instance Attribute Details

#firstObject (readonly) Also known as: first?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



23
24
25
# File 'lib/puppet/pops/types/string_converter.rb', line 23

def first
  @first
end

#is_indentingObject (readonly) Also known as: is_indenting?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



24
25
26
# File 'lib/puppet/pops/types/string_converter.rb', line 24

def is_indenting
  @is_indenting
end

#levelObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



22
23
24
# File 'lib/puppet/pops/types/string_converter.rb', line 22

def level
  @level
end

Instance Method Details

#breaks?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

API:

  • private



46
47
48
# File 'lib/puppet/pops/types/string_converter.rb', line 46

def breaks?
  is_indenting? && level > 0 && ! first?
end

#increase(indenting_flag = false) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



42
43
44
# File 'lib/puppet/pops/types/string_converter.rb', line 42

def increase(indenting_flag = false)
  self.class.new(level + 1, true, indenting_flag)
end

#indenting(indenting_flag) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



38
39
40
# File 'lib/puppet/pops/types/string_converter.rb', line 38

def indenting(indenting_flag)
  self.class.new(level, first?, indenting_flag)
end

#paddingObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



50
51
52
# File 'lib/puppet/pops/types/string_converter.rb', line 50

def padding
  return ' ' * 2 * level
end

#subsequentObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



34
35
36
# File 'lib/puppet/pops/types/string_converter.rb', line 34

def subsequent
  first? ? self.class.new(level, false, @is_indenting) : self
end