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.



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

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.



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

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.



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

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.



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

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:

  • (Boolean)


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

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.



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

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.



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

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.



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

def padding
  ' ' * 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.



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

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