Skip to content
This repository has been archived by the owner on May 22, 2021. It is now read-only.

Commit

Permalink
YARD
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Aug 21, 2012
1 parent 3410377 commit 038afa0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/abstractstack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class AbstractStack

attr_reader :limit

# @param [Integer] limit
def initialize(limit=nil)
@list = []
@limit = _limit_for limit
Expand All @@ -33,6 +34,7 @@ def initialize(limit=nil)

# @param [Object] value
# @return [value]
# @raise [OverFlow] if over the limit size of self
def push(value)
raise OverFlow if limit && (limit <= length)

Expand All @@ -42,13 +44,16 @@ def push(value)

alias_method :<<, :push

# @raise [UnderFlow] if self is empty when you call
def pop
raise UnderFlow if empty?

@list.pop
end

# @return [self]
# @yield [value]
# @yieldreturn [self]
# @return [Enumerator]
def fifo_each
return to_enum(__callee__) unless block_given?

Expand All @@ -58,7 +63,9 @@ def fifo_each

alias_method :lilo_each, :fifo_each

# @return [self]
# @yield [value]
# @yieldreturn [self]
# @return [Enumerator]
def filo_each
return to_enum(__callee__) unless block_given?

Expand Down

0 comments on commit 038afa0

Please sign in to comment.