module Mudguard::Domain::Texts
Builds texts to be displayed to a user
Public Instance Methods
dependency_allowed(dependency)
click to toggle source
# File lib/mudguard/domain/texts.rb, line 23 def dependency_allowed(dependency) dependency.to_s end
dependency_not_allowed(dependency)
click to toggle source
# File lib/mudguard/domain/texts.rb, line 13 def dependency_not_allowed(dependency) "#{dependency} not allowed" end
dependency_summary(file_count, dependency_count)
click to toggle source
# File lib/mudguard/domain/texts.rb, line 17 def dependency_summary(file_count, dependency_count) files = pluralize("file", file_count) "#{file_count} #{files} inspected, #{count(dependency_count)}\ good #{dependency(dependency_count)} detected" end
summary(file_count, violation_count)
click to toggle source
# File lib/mudguard/domain/texts.rb, line 7 def summary(file_count, violation_count) files = pluralize("file", file_count) "#{file_count} #{files} inspected, #{count(violation_count)}\ bad #{dependency(violation_count)} detected" end
Private Instance Methods
count(count)
click to toggle source
# File lib/mudguard/domain/texts.rb, line 33 def count(count) count.zero? ? "no" : count.to_s end
dependency(count)
click to toggle source
# File lib/mudguard/domain/texts.rb, line 29 def dependency(count) count <= 1 ? "dependency" : "dependencies" end
pluralize(word, count)
click to toggle source
# File lib/mudguard/domain/texts.rb, line 37 def pluralize(word, count) count == 1 ? word : "#{word}s" end