Sha256: 3e51f5170f076f5a3156470cda84457e370d2942e5c8f4a1922246aa1e9095e5

Contents?: true

Size: 1.48 KB

Versions: 14

Compression:

Stored size: 1.48 KB

Contents

module Hieracles
  class Format
    def initialize(node)
      @node = node
    end

    def info(_)
      "#{__callee__} not implemented, please inherit from the Hieracles::Format class to implement a format.\n"
    end

    def files(_)
      "#{__callee__} not implemented, please inherit from the Hieracles::Format class to implement a format.\n"
    end

    def paths(_)
      "#{__callee__} not implemented, please inherit from the Hieracles::Format class to implement a format.\n"
    end

    def params(args)
      show_params(true, args)
    end

    def allparams(args)
      show_params(false, args)
    end

    def show_params(without_common, args)
      filter = args[0]
      output = build_head(without_common)
      @node.params(without_common).each do |k, v|
        output << build_params_line(k, v, filter)
      end
      output
    end

    def modules(args)
      output = ''
      @node.modules.each do |k, v|
        output << build_modules_line(k, v)
      end
      output
    end

  protected

    def build_head(without_common)
      "#{__callee__} not implemented, please inherit from the Hieracles::Format class to implement a format.\n"
    end

    def build_params_line(key, value, filter)
      "#{__callee__} not implemented, please inherit from the Hieracles::Format class to implement a format.\n"
    end

    def build_modules_line(key, value)
      "#{__callee__} not implemented, please inherit from the Hieracles::Format class to implement a format.\n"
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
hieracles-0.1.7 lib/hieracles/format.rb
hieracles-0.1.6 lib/hieracles/format.rb
hieracles-0.1.5 lib/hieracles/format.rb
hieracles-0.1.4 lib/hieracles/format.rb
hieracles-0.1.3 lib/hieracles/format.rb
hieracles-0.1.2 lib/hieracles/format.rb
hieracles-0.1.1 lib/hieracles/format.rb
hieracles-0.1.0 lib/hieracles/format.rb
hieracles-0.0.6 lib/hieracles/format.rb
hieracles-0.0.5 lib/hieracles/format.rb
hieracles-0.0.4 lib/hieracles/format.rb
hieracles-0.0.3 lib/hieracles/format.rb
hieracles-0.0.2 lib/hieracles/format.rb
hieracles-0.0.1 lib/hieracles/format.rb