Class: BundleUpdateInteractive::Gemfile
- Inherits:
-
Object
- Object
- BundleUpdateInteractive::Gemfile
- Defined in:
- lib/bundle_update_interactive/gemfile.rb
Class Method Summary collapse
Instance Method Summary collapse
- #[](name) ⇒ Object
- #dependencies ⇒ Object
- #gem_names ⇒ Object
-
#initialize(dependencies) ⇒ Gemfile
constructor
A new instance of Gemfile.
Constructor Details
#initialize(dependencies) ⇒ Gemfile
Returns a new instance of Gemfile.
14 15 16 |
# File 'lib/bundle_update_interactive/gemfile.rb', line 14 def initialize(dependencies) @dependencies = dependencies.freeze end |
Class Method Details
.parse(path = "Gemfile") ⇒ Object
7 8 9 10 11 12 |
# File 'lib/bundle_update_interactive/gemfile.rb', line 7 def self.parse(path="Gemfile") dsl = Bundler::Dsl.new dsl.eval_gemfile(path) dependencies = dsl.dependencies.to_h { |d| [d.name, d] } new(dependencies) end |
Instance Method Details
#[](name) ⇒ Object
18 19 20 |
# File 'lib/bundle_update_interactive/gemfile.rb', line 18 def [](name) @dependencies[name] end |
#dependencies ⇒ Object
22 23 24 |
# File 'lib/bundle_update_interactive/gemfile.rb', line 22 def dependencies @dependencies.values end |
#gem_names ⇒ Object
26 27 28 |
# File 'lib/bundle_update_interactive/gemfile.rb', line 26 def gem_names dependencies.map(&:name) end |