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

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

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.

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


25
26
27
28
29
# File 'lib/puppet/pops/types/string_converter.rb', line 25

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.


20
21
22
# File 'lib/puppet/pops/types/string_converter.rb', line 20

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.


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

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.


19
20
21
# File 'lib/puppet/pops/types/string_converter.rb', line 19

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.


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

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.


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

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.


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

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.


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

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.


31
32
33
# File 'lib/puppet/pops/types/string_converter.rb', line 31

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