Top Level Namespace

Defined Under Namespace

Modules: Hiptest Classes: CliOptions, ConsoleFormatter, EmptiableString, FileConfigParser, LanguageConfigParser, LanguageGroupConfig, NodeRenderingContext, NullReporter, Option, OptionsParser, Reporter, String, TemplateFinder

Instance Method Summary collapse

Instance Method Details

#clean_path(path) ⇒ Object



37
38
39
# File 'lib/hiptest-publisher/utils.rb', line 37

def clean_path(path)
  Pathname.new(path).cleanpath.to_s
end

#hiptest_publisher_pathObject



8
9
10
11
12
# File 'lib/hiptest-publisher/utils.rb', line 8

def hiptest_publisher_path
  Gem.loaded_specs['hiptest-publisher'].full_gem_path
rescue
  '.'
end

#hiptest_publisher_versionObject



14
15
16
17
18
# File 'lib/hiptest-publisher/utils.rb', line 14

def hiptest_publisher_version
  Gem.loaded_specs['hiptest-publisher'].version.to_s
rescue
  File.read("#{hiptest_publisher_path}/VERSION").strip if File.exists?("#{hiptest_publisher_path}/VERSION")
end

#pluralize(count, singular, plural = nil) ⇒ Object



28
29
30
31
# File 'lib/hiptest-publisher/utils.rb', line 28

def pluralize(count, singular, plural=nil)
  word = pluralize_word(count, singular, plural)
  "#{count} #{word}"
end

#pluralize_word(count, singular, plural = nil) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/hiptest-publisher/utils.rb', line 20

def pluralize_word(count, singular, plural=nil)
  if count == 1
    singular
  else
    "#{singular}s"
  end
end

#singularize(name) ⇒ Object



33
34
35
# File 'lib/hiptest-publisher/utils.rb', line 33

def singularize(name)
  name.to_s.chomp("s")
end