Skip to content

Commit f6a47bc

Browse files
committed
Fix message each sticky flag without given block.
1 parent 76d1a14 commit f6a47bc

4 files changed

Lines changed: 21 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
## Unreleased
44

5-
- Enable file each message method and message iterator each method
6-
flag iterator each method to run without given block.
5+
- Enable file each message method, message iterator each method flag
6+
iterator each method, and message each sticky flag method to run
7+
without given block.
78

89
## CRuby and mruby version 0.3.0 - 2026-03-17
910

mrblib/mrb_gettextpo_common.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,12 @@ def file_positions
8282
positions
8383
end
8484

85-
def each_sticky_flag # yields: flag
85+
# call-seq:
86+
# each_sticky_flag { |flag| ... }
87+
# each_sticky_flag -> Enumerator
88+
def each_sticky_flag
89+
block_given? or return enum_for(__method__)
90+
8691
iter = sticky_flag_iterator
8792
while true
8893
begin

test.cruby/resources/flag.po

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#, fuzzy, no-wrap
2+
msgid "msgid1"
3+
msgstr "msgstr1"

test/message.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,12 @@
8787
assert_true message.sticky_flag?('no-wrap')
8888
true
8989
end
90+
91+
assert 'each flag' do
92+
path = File.expand_path(File.join(__FILE__, "../../test.cruby/resources/flag.po"))
93+
iterator = GettextPO::File.read(path).message_iterator
94+
message = iterator.next
95+
assert_equal ['no-wrap'], message.each_sticky_flag.to_a
96+
97+
true
98+
end

0 commit comments

Comments
 (0)