Class: Blondie::Builder
- Inherits:
-
Object
- Object
- Blondie::Builder
- Defined in:
- lib/blondie/builder.rb
Constant Summary collapse
- RUBY_GEMS_URL =
"https://rubygems.org/downloads/".freeze
Instance Attribute Summary collapse
-
#gemfile_path ⇒ Object
readonly
Returns the value of attribute gemfile_path.
Instance Method Summary collapse
-
#initialize(gemfile_path) ⇒ Builder
constructor
A new instance of Builder.
- #urls ⇒ Object
Constructor Details
#initialize(gemfile_path) ⇒ Builder
Returns a new instance of Builder.
10 11 12 |
# File 'lib/blondie/builder.rb', line 10 def initialize(gemfile_path) @gemfile_path = gemfile_path end |
Instance Attribute Details
#gemfile_path ⇒ Object (readonly)
Returns the value of attribute gemfile_path.
8 9 10 |
# File 'lib/blondie/builder.rb', line 8 def gemfile_path @gemfile_path end |
Instance Method Details
#urls ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/blondie/builder.rb', line 14 def urls @urls ||= {}.tap do |hash| gems_hash.each do |key, value| version = value.last&.gsub(/\"|'/, "") specifier = value.first.gsub(/\"|'/, "") if value.count == 2 specifier&.gsub!("\"", "") library = key.gsub(/('|,|")/, "") url = "#{RUBY_GEMS_URL}#{library}" url += versioned_url(library, specifier, version) hash[library] = url end end end |