<commit_before>

module JiraMule
  class Style
    def initialize(name, &block)
    end
  end



  Style(:basic) do |s|
    fields [:key, :summary]
    s.format %{{{key}} {{summary}}}
  end

  Style(:info) do
    fields [:key, :summary, :description, :assignee, :reporter, :priority,
            :issuetype, :status, :resolution, :votes, :watches]
    format %{{{key}}
    Summary: {{summary}}
   Reporter: {{reporter.displayName}}
   Assignee: {{assignee.displayName}}
       Type: {{issuetype.name}} ({{priority.name}})
     Status: {{status.name}} (Resolution: {{resolution.name}})
    Watches: {{watches.watchCount}}  Votes: {{votes.votes}}
Description: {{description}}
        }
  end

  Style(:progress) do
    fields [:key, :workratio, :aggregatetimespent, :duedate,
            :aggregatetimeoriginalestimate]
    format_type :table_rows
    header [:key, :estimated, :progress, :percent, :due]
    format [%{{{key}}},
            {:value=>%{{{estimate}}},:alignment=>:right},
            {:value=>%{{{progress}}},:alignment=>:right},
            {:value=>%{{{percent}}},:alignment=>:right},
            {:value=>%{{{duedate}}},:alignment=>:center},
    ]

    add_method(:estimate) do
    end
  end

end
#  vim: set ai et sw=2 ts=2 :
<commit_msg>Initial StyleLoader<commit_after>

module JiraMule
  class Style
    def initialize(name, &block)
      @name = name.to_sym
      @fields = [:key, :summary]
      @headers = [:key, :summary]
      @format_type = :strings
      @format = %{{{key}} {{summary}}}

      loadit(&block) if block_given?
    end

    def loadit(&block)
      block.call(self)
    end

    def self.add(style, &block)
      @@styles = {} unless defined?(@@styles)

      if style.kind_of?(String) or style.kind_of?(Symbol) then
        style = Style.new(style, &block)
      end

      @@styles[style.name] = style
    end

    def self.fetch(name)
      @@styles[name.to_sym]
    end

    ######################################################
    def name
      @name
    end

    # takes a single flat array of key names.
    def fields(args)
      return @fields if args.nil?
      @fields = args.flatten.map{|i| i.to_sym}
    end
    alias_method :fields=, :fields

    FORMAT_TYPES = [:strings, :table_rows, :table_columns, :table].freeze
    def format_type(type)
      return @format_type if type.nil?
      raise "Unknown format type: \"#{type}\"" unless FORMAT_TYPES.include? type
      @type = type
    end
    alias_method :format_type=, :format_type

    def header(args)
      return @header if args.nil?
      @header = args.flatten.map{|i| i.to_sym}
    end
    alias_method :header=, :header
    alias_method :headers=, :header
    alias_method :headers, :header

    def format(args)
      return @format if args.nil?
      args.flatten! if args.kind_of? Array
      @format = args
    end
    alias_method :format=, :format

    def add_method(name, &block)
    end
  end



#  Style(:basic) do |s|
#    s.fields [:key, :summary]
#    s.format %{{{key}} {{summary}}}
#  end
#
#  Style(:info) do |s|
#    s.fields [:key, :summary, :description, :assignee, :reporter, :priority,
#              :issuetype, :status, :resolution, :votes, :watches]
#    s.format %{{{key}}
#    Summary: {{summary}}
#   Reporter: {{reporter.displayName}}
#   Assignee: {{assignee.displayName}}
#       Type: {{issuetype.name}} ({{priority.name}})
#     Status: {{status.name}} (Resolution: {{resolution.name}})
#    Watches: {{watches.watchCount}}  Votes: {{votes.votes}}
#Description: {{description}}
#    }
#  end
#
#  Style(:progress) do |s|
#    s.fields [:key, :workratio, :aggregatetimespent, :duedate,
#              :aggregatetimeoriginalestimate]
#    s.format_type :table_rows
#    s.header [:key, :estimated, :progress, :percent, :due]
#    s.format [%{{{key}}},
#              {:value=>%{{{estimate}}},:alignment=>:right},
#              {:value=>%{{{progress}}},:alignment=>:right},
#              {:value=>%{{{percent}}},:alignment=>:right},
#              {:value=>%{{{duedate}}},:alignment=>:center},
#    ]
#
#    s.add_method(:estimate) do
#    end
#  end

end
#  vim: set ai et sw=2 ts=2 :

{'fraction_non_alphanumeric': 0.1844331641285956, 'fraction_numerical': 0.0009668842156151801, 'mean_word_length': 3.0135790494665375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '212835', 'n_tokens_mistral': 1468, 'n_tokens_neox': 1401, 'n_words': 312}