Don't use deprecated form of attr

The form "attr :name, true" is deprecated and causes Ruby to emit a
warning in verbose mode. Using attr_{reader,writer,accessor} is more
clear anyway, so do so.
This commit is contained in:
Jack Nagel 2013-02-17 22:52:39 -06:00
parent baffb31aab
commit f172d3a6eb
4 changed files with 15 additions and 28 deletions

View File

@ -73,9 +73,7 @@ class FormulaText
end end
class FormulaAuditor class FormulaAuditor
attr :f attr_reader :f, :text, :problems
attr :text
attr :problems, true
BUILD_TIME_DEPS = %W[ BUILD_TIME_DEPS = %W[
autoconf autoconf

View File

@ -71,12 +71,8 @@ module Homebrew extend self
end end
class FormulaCreator class FormulaCreator
attr :url attr_reader :url, :sha1
attr :sha1 attr_accessor :name, :version, :path, :mode
attr :name, true
attr :version, true
attr :path, true
attr :mode, true
def url= url def url= url
@url = url @url = url

View File

@ -3,7 +3,7 @@ class FormulaUnspecifiedError < UsageError; end
class KegUnspecifiedError < UsageError; end class KegUnspecifiedError < UsageError; end
class MultipleVersionsInstalledError < RuntimeError class MultipleVersionsInstalledError < RuntimeError
attr :name attr_reader :name
def initialize name def initialize name
@name = name @name = name
@ -14,7 +14,7 @@ end
class NotAKegError < RuntimeError; end class NotAKegError < RuntimeError; end
class NoSuchKegError < RuntimeError class NoSuchKegError < RuntimeError
attr :name attr_reader :name
def initialize name def initialize name
@name = name @name = name
@ -23,8 +23,8 @@ class NoSuchKegError < RuntimeError
end end
class FormulaUnavailableError < RuntimeError class FormulaUnavailableError < RuntimeError
attr :name attr_reader :name
attr :dependent, true attr_accessor :dependent
def dependent_s def dependent_s
"(dependency of #{dependent})" if dependent and dependent != name "(dependency of #{dependent})" if dependent and dependent != name
@ -59,7 +59,7 @@ end
module Homebrew module Homebrew
class InstallationError < RuntimeError class InstallationError < RuntimeError
attr :formula attr_reader :formula
def initialize formula, message="" def initialize formula, message=""
super message super message
@ -87,7 +87,7 @@ class UnsatisfiedDependencyError < Homebrew::InstallationError
end end
class UnsatisfiedRequirements < Homebrew::InstallationError class UnsatisfiedRequirements < Homebrew::InstallationError
attr :reqs attr_reader :reqs
def initialize formula, reqs def initialize formula, reqs
@reqs = reqs @reqs = reqs
@ -99,9 +99,7 @@ class UnsatisfiedRequirements < Homebrew::InstallationError
end end
class BuildError < Homebrew::InstallationError class BuildError < Homebrew::InstallationError
attr :exit_status attr_reader :exit_status, :command, :env
attr :command
attr :env
def initialize formula, cmd, args, es def initialize formula, cmd, args, es
@command = cmd @command = cmd
@ -159,10 +157,8 @@ end
# raised by Pathname#verify_checksum when verification fails # raised by Pathname#verify_checksum when verification fails
class ChecksumMismatchError < RuntimeError class ChecksumMismatchError < RuntimeError
attr :advice, true attr_accessor :advice
attr :expected attr_reader :expected, :actual, :hash_type
attr :actual
attr :hash_type
def initialize expected, actual def initialize expected, actual
@expected = expected @expected = expected

View File

@ -6,12 +6,9 @@ require 'bottles'
require 'caveats' require 'caveats'
class FormulaInstaller class FormulaInstaller
attr :f attr_reader :f
attr :tab, true attr_accessor :tab, :options, :ignore_deps
attr :options, true attr_accessor :show_summary_heading, :show_header
attr :show_summary_heading, true
attr :ignore_deps, true
attr :show_header, true
def initialize ff def initialize ff
@f = ff @f = ff