Class: Obvious::Generators::Application

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/generators/helpers/application.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeApplication

Returns a new instance of Application.



10
11
12
13
14
15
16
17
18
# File 'lib/generators/helpers/application.rb', line 10

def initialize
  @dir = 'app'

  counter = 1
  while File.directory? @dir
    @dir = "app_#{counter}"
    counter += 1
  end
end

Instance Attribute Details

#dirObject (readonly)

Returns the value of attribute dir.



8
9
10
# File 'lib/generators/helpers/application.rb', line 8

def dir
  @dir
end

#entitiesObject (readonly)

Returns the value of attribute entities.



8
9
10
# File 'lib/generators/helpers/application.rb', line 8

def entities
  @entities
end

#jacksObject (readonly)

Returns the value of attribute jacks.



8
9
10
# File 'lib/generators/helpers/application.rb', line 8

def jacks
  @jacks
end

Instance Method Details

#lib_pathObject



32
33
34
# File 'lib/generators/helpers/application.rb', line 32

def lib_path
  Gem::Specification.find_by_name("obvious").gem_dir + '/lib'
end

#remove_duplicatesObject



36
37
38
39
40
41
42
43
44
# File 'lib/generators/helpers/application.rb', line 36

def remove_duplicates
  entities.each do |k, v|
    v.uniq!
  end

  jacks.each do |k,v|
    v.uniq!
  end
end

#target_pathObject



28
29
30
# File 'lib/generators/helpers/application.rb', line 28

def target_path
  File.realpath Dir.pwd
end