lib/mercurial-ruby/branch.rb in mercurial-ruby-0.7.11 vs lib/mercurial-ruby/branch.rb in mercurial-ruby-0.7.12
- old
+ new
@@ -25,20 +25,24 @@
# ID of a commit associated with the branch. 40-chars long SHA1 hash.
attr_reader :hash_id
def initialize(repository, name, options={})
@repository = repository
- @name = name
- @status = options[:status] == 'closed' ? 'closed' : 'active'
+ @name = name.strip
+ @status = ['closed', 'inactive'].include?(options[:status]) ? options[:status] : 'active'
@hash_id = options[:commit]
end
def commit
repository.commits.by_hash_id(hash_id)
end
def active?
status == 'active'
+ end
+
+ def inactive?
+ status == 'inactive'
end
def closed?
status == 'closed'
end
\ No newline at end of file