Skip to Content Skip to Search

class Rails::Generators::AppBase::GemfileEntry

Inherits From

Public class methods

Source code GitHub
# File railties/lib/rails/generators/app_base.rb, line 428
def self.floats(name, comment = nil)
  new(name, nil, comment)
end
Source code GitHub
# File railties/lib/rails/generators/app_base.rb, line 416
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
Source code GitHub
# File railties/lib/rails/generators/app_base.rb, line 412
def initialize(name, version, comment, options = {}, commented_out = false)
  super
end
Source code GitHub
# File railties/lib/rails/generators/app_base.rb, line 432
def self.path(name, path, comment = nil)
  new(name, nil, comment, path: path)
end
Source code GitHub
# File railties/lib/rails/generators/app_base.rb, line 424
def self.version(name, version, comment = nil)
  new(name, version, comment)
end

Public instance methods

Source code GitHub
# File railties/lib/rails/generators/app_base.rb, line 436
def to_s
  [
    (comment.gsub(/^/, "# ").chomp + "\n" if comment),
    ("# " if commented_out),
    "gem \"#{name}\"",
    *Array(version).map { |constraint| ", \"#{constraint}\"" },
    *options.map { |key, value| ", #{key}: #{value.inspect}" },
  ].compact.join
end

Definition files