Class: Rails::Generators::AppBase::GemfileEntry

Inherits:
Struct show all
Defined in:
railties/lib/rails/generators/app_base.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Struct

#as_json, #to_h

Constructor Details

#initialize(name, version, comment, options = {}, commented_out = false) ⇒ GemfileEntry

Returns a new instance of GemfileEntry.



176
177
178
# File 'railties/lib/rails/generators/app_base.rb', line 176

def initialize(name, version, comment, options = {}, commented_out = false)
  super
end

Class Method Details

.github(name, github, branch = nil, comment = nil) ⇒ Object



180
181
182
183
184
185
186
# File 'railties/lib/rails/generators/app_base.rb', line 180

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



192
193
194
# File 'railties/lib/rails/generators/app_base.rb', line 192

def self.path(name, path, comment = nil)
  new(name, nil, comment, path: path)
end

.version(name, version, comment = nil) ⇒ Object



188
189
190
# File 'railties/lib/rails/generators/app_base.rb', line 188

def self.version(name, version, comment = nil)
  new(name, version, comment)
end

Instance Method Details

#padding(max_width) ⇒ Object



196
197
198
# File 'railties/lib/rails/generators/app_base.rb', line 196

def padding(max_width)
  ' ' * (max_width - name.length + 2)
end