Class: Bottle::Filename

Inherits:
Object
  • Object
show all
Defined in:
Library/Homebrew/software_spec.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, version, tag, rebuild) ⇒ Filename

Returns a new instance of Filename



253
254
255
256
257
258
# File 'Library/Homebrew/software_spec.rb', line 253

def initialize(name, version, tag, rebuild)
  @name = name
  @version = version
  @tag = tag.to_s.gsub(/_or_later$/, "")
  @rebuild = rebuild
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name



247
248
249
# File 'Library/Homebrew/software_spec.rb', line 247

def name
  @name
end

#rebuildObject (readonly)

Returns the value of attribute rebuild



247
248
249
# File 'Library/Homebrew/software_spec.rb', line 247

def rebuild
  @rebuild
end

#tagObject (readonly)

Returns the value of attribute tag



247
248
249
# File 'Library/Homebrew/software_spec.rb', line 247

def tag
  @tag
end

#versionObject (readonly)

Returns the value of attribute version



247
248
249
# File 'Library/Homebrew/software_spec.rb', line 247

def version
  @version
end

Class Method Details

.create(formula, tag, rebuild) ⇒ Object



249
250
251
# File 'Library/Homebrew/software_spec.rb', line 249

def self.create(formula, tag, rebuild)
  new(formula.name, formula.pkg_version, tag, rebuild)
end

Instance Method Details

#prefixObject



265
266
267
# File 'Library/Homebrew/software_spec.rb', line 265

def prefix
  "#{name}-#{version}.#{tag}"
end

#suffixObject



269
270
271
272
# File 'Library/Homebrew/software_spec.rb', line 269

def suffix
  s = rebuild.positive? ? ".#{rebuild}" : ""
  ".bottle#{s}.tar.gz"
end

#to_sObject Also known as: to_str



260
261
262
# File 'Library/Homebrew/software_spec.rb', line 260

def to_s
  prefix + suffix
end