class Build::Text::Indentation

Constants

TAB

Public Class Methods

new(prefix, level, indent) click to toggle source
# File lib/build/text/indentation.rb, line 26
def initialize(prefix, level, indent)
        @prefix = prefix
        @level = level
        @indent = indent
end
none() click to toggle source
# File lib/build/text/indentation.rb, line 62
def self.none
        self.new('', 0, TAB)
end

Public Instance Methods

+(other) click to toggle source
# File lib/build/text/indentation.rb, line 46
def + other
        indentation + other
end
<<(text) click to toggle source
# File lib/build/text/indentation.rb, line 50
def << text
        text.gsub(/^/){|m| m + indentation}
end
by(depth) click to toggle source
# File lib/build/text/indentation.rb, line 54
def by(depth)
        Indentation.new(@prefix, @level + depth, @indent)
end
freeze() click to toggle source
Calls superclass method
# File lib/build/text/indentation.rb, line 32
def freeze
        indentation
        
        @prefix.freeze
        @level.freeze
        @indent.freeze
        
        super
end
indentation() click to toggle source
# File lib/build/text/indentation.rb, line 42
def indentation
        @indentation ||= @prefix + (@indent * @level)
end
with_prefix(prefix) click to toggle source
# File lib/build/text/indentation.rb, line 58
def with_prefix(prefix)
        Indentation.new(prefix, @level, @indent)
end