Class: Rails::Generators::AppBase::GemfileEntry
- Inherits:
-
Struct
- Object
- Struct
- Rails::Generators::AppBase::GemfileEntry
- Defined in:
- lib/rails/generators/app_base.rb
Class Method Summary collapse
- .floats(name, comment = nil) ⇒ Object
- .github(name, github, branch = nil, comment = nil) ⇒ Object
- .path(name, path, comment = nil) ⇒ Object
- .version(name, version, comment = nil) ⇒ Object
Instance Method Summary collapse
-
#initialize(name, version, comment, options = {}, commented_out = false) ⇒ GemfileEntry
constructor
A new instance of GemfileEntry.
- #to_s ⇒ Object
Constructor Details
#initialize(name, version, comment, options = {}, commented_out = false) ⇒ GemfileEntry
Returns a new instance of GemfileEntry.
421 422 423 |
# File 'lib/rails/generators/app_base.rb', line 421 def initialize(name, version, comment, = {}, commented_out = false) super end |
Class Method Details
.floats(name, comment = nil) ⇒ Object
437 438 439 |
# File 'lib/rails/generators/app_base.rb', line 437 def self.floats(name, comment = nil) new(name, nil, comment) end |
.github(name, github, branch = nil, comment = nil) ⇒ Object
425 426 427 428 429 430 431 |
# File 'lib/rails/generators/app_base.rb', line 425 def self.github(name, github, branch = nil, comment = nil) if branch new(name, nil, comment, github: github, branch: branch) else new(name, nil, comment, github: github) end end |
.path(name, path, comment = nil) ⇒ Object
441 442 443 |
# File 'lib/rails/generators/app_base.rb', line 441 def self.path(name, path, comment = nil) new(name, nil, comment, path: path) end |
.version(name, version, comment = nil) ⇒ Object
433 434 435 |
# File 'lib/rails/generators/app_base.rb', line 433 def self.version(name, version, comment = nil) new(name, version, comment) end |
Instance Method Details
#to_s ⇒ Object
445 446 447 448 449 450 451 452 453 |
# File 'lib/rails/generators/app_base.rb', line 445 def to_s [ (comment.gsub(/^/, "# ").chomp + "\n" if comment), ("# " if commented_out), "gem \"#{name}\"", *Array(version).map { |constraint| ", \"#{constraint}\"" }, *.map { |key, value| ", #{key}: #{value.inspect}" }, ].compact.join end |