Class: Stupidedi::Reader::SegmentDict
- Includes:
- Inspect
- Defined in:
- lib/stupidedi/reader/segment_dict.rb
Direct Known Subclasses
Defined Under Namespace
Constant Summary collapse
- Empty =
Class.new(SegmentDict) do def top raise TypeError, "empty stack" end def pop raise TypeError, "stack underflow" end def push(top) if top.is_a?(Module) NonEmpty.new(Constants.new(top), self) else NonEmpty.new(top, self) end end def defined_at?(segment_id) false end def at(segment_id) raise TypeError, "empty stack" end def empty? true end # @return [void] def pretty_print(q) q.text "SegmentDict.empty" end end.new
Constructors collapse
Instance Method Summary collapse
-
#pop ⇒ SegmentDict
Return the remainder of the stack.
-
#push ⇒ SegmentDict
Returns a new SegmentDict with
top
pushed to the top of the stack.
Methods included from Inspect
Class Method Details
.build(top) ⇒ SegmentDict::NonEmpty
167 168 169 |
# File 'lib/stupidedi/reader/segment_dict.rb', line 167 def build(top) SegmentDict::Empty.push(top) end |
.empty ⇒ SegmentDict::Empty
162 163 164 |
# File 'lib/stupidedi/reader/segment_dict.rb', line 162 def empty SegmentDict::Empty end |
Instance Method Details
#pop ⇒ SegmentDict
Return the remainder of the stack. This will throw an exception if the stack is #empty?
19 |
# File 'lib/stupidedi/reader/segment_dict.rb', line 19 abstract :pop |
#push ⇒ SegmentDict
Returns a new SegmentDict with top
pushed to the top of the stack
24 |
# File 'lib/stupidedi/reader/segment_dict.rb', line 24 abstract :push, :args => %w(top) |