Sha256: 89fcd36f6511998b29b70a5b9637c5dc345cd29e57729525ea0ed79003ec4a00
Contents?: true
Size: 833 Bytes
Versions: 5
Compression:
Stored size: 833 Bytes
Contents
module HammerCLI module Help class AbstractItem INDENT_STEP = 2 attr_reader :id attr_accessor :definition def initialize(options = {}) @id = options[:id] @indentation = options[:indentation] end def build_string raise NotImplementedError end def self.indent(content, indentation = nil) indentation ||= ' ' * INDENT_STEP content = content.split("\n") unless content.is_a? Array content.map do |line| (indentation + line).rstrip end.join("\n") end protected def build_definition(content) raise NotImplementedError end def indent(content, indentation = nil) indentation ||= @indentation self.class.indent(content, indentation) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems