Class: Anchor::Types::NodeStream
- Inherits:
-
Object
- Object
- Anchor::Types::NodeStream
- Includes:
- Enumerable
- Defined in:
- lib/anchor/types.rb
Instance Method Summary collapse
- #each(&blk) ⇒ Object
- #enums ⇒ Object
-
#initialize(root) ⇒ NodeStream
constructor
A new instance of NodeStream.
- #of_kind(klass) ⇒ Object
- #references ⇒ Object
- #resources ⇒ Object
Constructor Details
#initialize(root) ⇒ NodeStream
Returns a new instance of NodeStream.
6 |
# File 'lib/anchor/types.rb', line 6 def initialize(root) = @root = root |
Instance Method Details
#each(&blk) ⇒ Object
8 9 10 11 |
# File 'lib/anchor/types.rb', line 8 def each(&blk) return enum_for(:each) unless blk walk(@root, &blk) end |
#of_kind(klass) ⇒ Object
13 14 15 |
# File 'lib/anchor/types.rb', line 13 def of_kind(klass) select { |n| n.is_a?(Class) ? n <= klass : n.is_a?(klass) } end |