Class: Obvious::Generators::Application
- Inherits:
-
Object
- Object
- Obvious::Generators::Application
- Includes:
- Singleton
- Defined in:
- lib/generators/helpers/application.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#entities ⇒ Object
readonly
Returns the value of attribute entities.
-
#jacks ⇒ Object
readonly
Returns the value of attribute jacks.
Instance Method Summary collapse
-
#initialize ⇒ Application
constructor
A new instance of Application.
- #lib_path ⇒ Object
- #remove_duplicates ⇒ Object
- #target_path ⇒ Object
Constructor Details
#initialize ⇒ Application
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
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
8 9 10 |
# File 'lib/generators/helpers/application.rb', line 8 def dir @dir end |
#entities ⇒ Object (readonly)
Returns the value of attribute entities.
8 9 10 |
# File 'lib/generators/helpers/application.rb', line 8 def entities @entities end |
#jacks ⇒ Object (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_path ⇒ Object
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_duplicates ⇒ Object
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_path ⇒ Object
28 29 30 |
# File 'lib/generators/helpers/application.rb', line 28 def target_path File.realpath Dir.pwd end |