Class: GemSuit::Application::Utils::Gemfile
- Inherits:
-
Object
- Object
- GemSuit::Application::Utils::Gemfile
- Defined in:
- lib/gem_suit/application/utils/gemfile.rb
Instance Attribute Summary collapse
-
#source(src) ⇒ Object
A simple class which derives a Gemfile.
Instance Method Summary collapse
- #gem(name, *args) ⇒ Object
- #gems ⇒ Object
-
#initialize(*files) ⇒ Gemfile
constructor
A new instance of Gemfile.
- #method_missing(method, *args) ⇒ Object
Constructor Details
#initialize(*files) ⇒ Gemfile
Returns a new instance of Gemfile.
10 11 12 |
# File 'lib/gem_suit/application/utils/gemfile.rb', line 10 def initialize(*files) @files = files end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
34 35 36 37 |
# File 'lib/gem_suit/application/utils/gemfile.rb', line 34 def method_missing(method, *args) # e.g. group :test do # end end |
Instance Attribute Details
#source(src) ⇒ Object
A simple class which derives a Gemfile
8 9 10 |
# File 'lib/gem_suit/application/utils/gemfile.rb', line 8 def source @source end |
Instance Method Details
#gem(name, *args) ⇒ Object
28 29 30 31 32 |
# File 'lib/gem_suit/application/utils/gemfile.rb', line 28 def gem(name, *args) = (args.pop if args.last.is_a?(Hash)) || {} [:version] = args.first if args.first.is_a?(String) @gems[name] = end |
#gems ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/gem_suit/application/utils/gemfile.rb', line 14 def gems @gems ||= begin @gems = {} gem_file = @files.detect{|file| File.exists? file} gem_specs = File.readlines(gem_file).join "\n" instance_eval gem_specs gems end end |