Module: Gitara::Utilities

Defined in:
lib/gitara/utilities.rb

Defined Under Namespace

Classes: PathnameDoesNotExist

Class Method Summary collapse

Class Method Details

.id_as_word(id) ⇒ Object



6
7
8
# File 'lib/gitara/utilities.rb', line 6

def self.id_as_word(id)
  id.en.numwords.gsub('-', '_').camelize
end

.inspect_attributes(object, *attributes) ⇒ Object



10
11
12
# File 'lib/gitara/utilities.rb', line 10

def self.inspect_attributes(object, *attributes)
  "#{object.class}(" + attributes.collect{|a| "#{a}=#{object.send(a).inspect}"}.join(', ') + ")"
end

.read!(pathname) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/gitara/utilities.rb', line 14

def self.read!(pathname)
  if pathname.exist?
    pathname.read
  else
    raise PathnameDoesNotExist, "#{pathname} does not exist"
  end
end