Skip to content

Commit

Permalink
Make RawIterator generic (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-shoota authored Mar 10, 2024
1 parent 5d5c190 commit bc1c534
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion spec/interpreter/value_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ describe Crinja::Value do
end

it "raw_#each" do
Crinja::Value.new([1]).raw_each.should be_a(Crinja::Value::RawIterator)
# be_a matcher doesn't support uninstantiated generic type
Crinja::Value.new([1]).raw_each.is_a?(Crinja::Value::RawIterator).should be_true

Crinja::Value.new([1]).raw_each.each_with_index do |item, index|
item.should eq 1
index.should eq 0
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/value.cr
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,11 @@ struct Crinja::Value
end

# :nodoc:
class RawIterator
class RawIterator(T)
include ::Iterator(Raw)
include IteratorWrapper

def initialize(@iterator : ::Iterator(Value))
def initialize(@iterator : T)
end

def next
Expand Down

0 comments on commit bc1c534

Please sign in to comment.