class Milestoner::Views::Parts::Commit
The commit presentation logic. :reek: RepeatedConditional
Public Class Methods
new(**)
click to toggle source
Calls superclass method
# File lib/milestoner/views/parts/commit.rb, line 20 def initialize(**) super @prefixes = settings.commit_categories.pluck :label @authored_at = Time.at value.authored_at.to_i end
Public Instance Methods
at(= authored_at.strftime "%Y-%m-%dT%H:%M:%S%z")
click to toggle source
# File lib/milestoner/views/parts/commit.rb, line 90 def at = authored_at.strftime "%Y-%m-%dT%H:%M:%S%z" def datetime = authored_at.strftime "%Y-%m-%d (%A) %I:%M %p %Z" def weekday = authored_at.strftime "%A" def date = authored_at.strftime "%Y-%m-%d" def time = authored_at.strftime "%I:%M %p" def zone = authored_at.strftime "%Z" private attr_reader :prefixes, :authored_at def prefix = value.prefix end
avatar_url(user)
click to toggle source
# File lib/milestoner/views/parts/commit.rb, line 26 def avatar_url user warn "`#{self.class}##{__method__}` is deprecated, use user scope instead.", category: :deprecated format settings.avatar_uri, id: user.external_id end
date(= authored_at.strftime "%Y-%m-%d")
click to toggle source
# File lib/milestoner/views/parts/commit.rb, line 96 def date = authored_at.strftime "%Y-%m-%d" def time = authored_at.strftime "%I:%M %p" def zone = authored_at.strftime "%Z" private attr_reader :prefixes, :authored_at def prefix = value.prefix end end end end
datetime(= authored_at.strftime "%Y-%m-%d (%A) %I:%M %p %Z")
click to toggle source
# File lib/milestoner/views/parts/commit.rb, line 92 def datetime = authored_at.strftime "%Y-%m-%d (%A) %I:%M %p %Z" def weekday = authored_at.strftime "%A" def date = authored_at.strftime "%Y-%m-%d" def time = authored_at.strftime "%I:%M %p" def zone = authored_at.strftime "%Z" private attr_reader :prefixes, :authored_at def prefix = value.prefix end end
emoji()
click to toggle source
# File lib/milestoner/views/parts/commit.rb, line 47 def emoji settings.commit_categories .find { |category| category.fetch(:label) == prefix } .then { |category| category ? category.fetch(:emoji) : "🔶" } end
fingerprint(= value.fingerprint.then { |text| text.empty? ? "N/A" : text })
click to toggle source
# File lib/milestoner/views/parts/commit.rb, line 86 def fingerprint = value.fingerprint.then { |text| text.empty? ? "N/A" : text } def fingerprint_key = value.fingerprint_key.then { |text| text.empty? ? "N/A" : text } def at = authored_at.strftime "%Y-%m-%dT%H:%M:%S%z" def datetime = authored_at.strftime "%Y-%m-%d (%A) %I:%M %p %Z" def weekday = authored_at.strftime "%A" def date = authored_at.strftime "%Y-%m-%d" def time = authored_at.strftime "%I:%M %p" def zone = authored_at.strftime "%Z" private attr_reader :prefixes, :authored_at def prefix = value.prefix
fingerprint_key(= value.fingerprint_key.then { |text| text.empty? ? "N/A" : text })
click to toggle source
# File lib/milestoner/views/parts/commit.rb, line 88 def fingerprint_key = value.fingerprint_key.then { |text| text.empty? ? "N/A" : text } def at = authored_at.strftime "%Y-%m-%dT%H:%M:%S%z" def datetime = authored_at.strftime "%Y-%m-%d (%A) %I:%M %p %Z" def weekday = authored_at.strftime "%A" def date = authored_at.strftime "%Y-%m-%d" def time = authored_at.strftime "%I:%M %p" def zone = authored_at.strftime "%Z" private attr_reader :prefixes, :authored_at def prefix = value.prefix end
icon()
click to toggle source
# File lib/milestoner/views/parts/commit.rb, line 53 def icon if prefixes.include? prefix then String(prefix).downcase elsif value.directive? then "rebase" else "invalid" end end
kind()
click to toggle source
# File lib/milestoner/views/parts/commit.rb, line 40 def kind if prefixes.include? prefix then "normal" elsif value.directive? then "alert" else "error" end end
popover_id(= "po-
click to toggle source
# File lib/milestoner/views/parts/commit.rb, line 78 def popover_id = "po-#{value.sha}" def security = value.signature == "Good" ? "secure" : "insecure" def signature_label value.signature.then { |kind| kind == "Good" ? "🔒 #{kind}" : "🔓 #{kind}" } end def fingerprint = value.fingerprint.then { |text| text.empty? ? "N/A" : text } def fingerprint_key = value.fingerprint_key.then { |text| text.empty? ? "N/A" : text } def at = authored_at.strftime "%Y-%m-%dT%H:%M:%S%z" def datetime = authored_at.strftime "%Y-%m-%d (%A) %I:%M %p %Z" def weekday = authored_at.strftime "%A" def date = authored_at.strftime "%Y-%m-%d" def time = authored_at.strftime "%I:%M %p" def zone = authored_at.strftime "%Z" private attr_reader :prefixes, :authored_at def prefix =
prefix(= value.prefix)
click to toggle source
# File lib/milestoner/views/parts/commit.rb, line 106 def prefix = value.prefix end
profile_url(user)
click to toggle source
# File lib/milestoner/views/parts/commit.rb, line 33 def profile_url user warn "`#{self.class}##{__method__}` is deprecated, use user scope instead.", category: :deprecated format settings.profile_uri, id: user.handle end
safe_body(= sanitizer.call(value.body).html_safe)
click to toggle source
# File lib/milestoner/views/parts/commit.rb, line 60 def safe_body = sanitizer.call(value.body).html_safe def safe_notes = sanitizer.call(value.notes).html_safe def total_deletions = format "%d", -value.deletions # :reek:FeatureEnvy def total_insertions value.insertions.then { |total| total.positive? ? "+#{total}" : total.to_s } end def tag return "rebase" if value.directive? return "invalid" unless prefixes.include? prefix value.milestone end def popover_id = "po-#{value.sha}" def security = value.signature == "Good" ? "secure" : "insecure" def signature_label value.signature.then { |kind| kind == "Good" ? "🔒 #{kind}" : "🔓 #{kind}" } end def fingerprint = value.fingerprint.then { |text| text.empty? ? "N/A" : text } def fingerprint_key = value.fingerprint_key.then { |text| text.empty? ? "N/A" : text } def at = authored_at.strftime "%Y-%m-%dT%H:%M:%S%z" def datetime = authored_at.strftime "%Y-%m-%d (%A) %I:%M %p %Z" def weekday = authored_at.strftime "%A" def date = authored_at.strftime "%Y-%m-%d" def time = authored_at.strftime "%I:%M %p" def zone = authored_at.strftime "%Z" private attr_reader :prefixes, :authored_at
safe_notes(= sanitizer.call(value.notes).html_safe)
click to toggle source
# File lib/milestoner/views/parts/commit.rb, line 62 def safe_notes = sanitizer.call(value.notes).html_safe def total_deletions = format "%d", -value.deletions # :reek:FeatureEnvy def total_insertions value.insertions.then { |total| total.positive? ? "+#{total}" : total.to_s } end def tag return "rebase" if value.directive? return "invalid" unless prefixes.include? prefix value.milestone end def popover_id = "po-#{value.sha}" def security = value.signature == "Good" ? "secure" : "insecure" def signature_label value.signature.then { |kind| kind == "Good" ? "🔒 #{kind}" : "🔓 #{kind}" } end def fingerprint = value.fingerprint.then { |text| text.empty? ? "N/A" : text } def fingerprint_key = value.fingerprint_key.then { |text| text.empty? ? "N/A" : text } def at = authored_at.strftime "%Y-%m-%dT%H:%M:%S%z" def datetime = authored_at.strftime "%Y-%m-%d (%A) %I:%M %p %Z" def weekday = authored_at.strftime "%A" def date = authored_at.strftime "%Y-%m-%d" def time = authored_at.strftime "%I:%M %p" def zone = authored_at.strftime "%Z" private attr_reader :prefixes, :authored_at def
security(= value.signature == "Good" ? "secure" : "insecure")
click to toggle source
# File lib/milestoner/views/parts/commit.rb, line 80 def security = value.signature == "Good" ? "secure" : "insecure" def signature_label value.signature.then { |kind| kind == "Good" ? "🔒 #{kind}" : "🔓 #{kind}" } end def fingerprint = value.fingerprint.then { |text| text.empty? ? "N/A" : text } def fingerprint_key = value.fingerprint_key.then { |text| text.empty? ? "N/A" : text } def at = authored_at.strftime "%Y-%m-%dT%H:%M:%S%z" def datetime = authored_at.strftime "%Y-%m-%d (%A) %I:%M %p %Z" def weekday = authored_at.strftime "%A" def date = authored_at.strftime "%Y-%m-%d" def time = authored_at.strftime "%I:%M %p" def zone = authored_at.strftime "%Z" private attr_reader :prefixes, :authored_at def prefix = value.
signature_label()
click to toggle source
# File lib/milestoner/views/parts/commit.rb, line 82 def signature_label value.signature.then { |kind| kind == "Good" ? "🔒 #{kind}" : "🔓 #{kind}" } end
tag()
click to toggle source
# File lib/milestoner/views/parts/commit.rb, line 71 def tag return "rebase" if value.directive? return "invalid" unless prefixes.include? prefix value.milestone end
time(= authored_at.strftime "%I:%M %p")
click to toggle source
# File lib/milestoner/views/parts/commit.rb, line 98 def time = authored_at.strftime "%I:%M %p" def zone = authored_at.strftime "%Z" private attr_reader :prefixes, :authored_at def prefix = value.prefix end end end
total_deletions(= format "%d", -value.deletions)
click to toggle source
# File lib/milestoner/views/parts/commit.rb, line 64 def total_deletions = format "%d", -value.deletions # :reek:FeatureEnvy def total_insertions value.insertions.then { |total| total.positive? ? "+#{total}" : total.to_s } end def tag return "rebase" if value.directive? return "invalid" unless prefixes.include? prefix value.milestone end def popover_id = "po-#{value.sha}" def security = value.signature == "Good" ? "secure" : "insecure" def signature_label value.signature.then { |kind| kind == "Good" ? "🔒 #{kind}" : "🔓 #{kind}" } end def fingerprint = value.fingerprint.then { |text| text.empty? ? "N/A" : text } def fingerprint_key = value.fingerprint_key.then { |text| text.empty? ? "N/A" : text } def at = authored_at.strftime "%Y-%m-%dT%H:%M:%S%z" def datetime = authored_at.strftime "%Y-%m-%d (%A) %I:%M %p %Z" def weekday = authored_at.strftime "%A" def date = authored_at.strftime "%Y-%m-%d" def time = authored_at.strftime "%I:%M %p" def zone = authored_at.strftime "%Z" private attr_reader :prefixes, :authored_at def prefix
total_insertions()
click to toggle source
:reek: FeatureEnvy
# File lib/milestoner/views/parts/commit.rb, line 67 def total_insertions value.insertions.then { |total| total.positive? ? "+#{total}" : total.to_s } end
weekday(= authored_at.strftime "%A")
click to toggle source
# File lib/milestoner/views/parts/commit.rb, line 94 def weekday = authored_at.strftime "%A" def date = authored_at.strftime "%Y-%m-%d" def time = authored_at.strftime "%I:%M %p" def zone = authored_at.strftime "%Z" private attr_reader :prefixes, :authored_at def prefix = value.prefix end end end
zone(= authored_at.strftime "%Z")
click to toggle source
# File lib/milestoner/views/parts/commit.rb, line 100 def zone = authored_at.strftime "%Z" private attr_reader :prefixes, :authored_at def prefix = value.prefix end end