Skip to content

Commit 1ecf8e2

Browse files
committed
Add message each flags methods.
1 parent 0d847bb commit 1ecf8e2

3 files changed

Lines changed: 35 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
## Unreleased
44

5-
- Add `GettextPO::File#each_message` method.
5+
- Add `GettextPO::File#each_message`,
6+
`GettextPO::Message#each_workflow_flag`, and
7+
`GettextPO::Message#each_sticky_flag` methods.
68

79
## CRuby version 0.2.1 - 2026-03-16
810

ext/gettextpo/gettextpo.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,11 @@ UPDATE_FLAG (workflow);
487487

488488
/**
489489
* Document-method: workflow_flag_iterator
490+
* call-seq: workflow_flag_iterator -> GettextPO::FlagIterator
491+
*
492+
* You may find it handy to use the #workflow_flag_iterator method to
493+
* iterate over the sticky flag. This is for more versatile
494+
* manipulation.
490495
*/
491496
FLAG_ITER (workflow);
492497

@@ -565,6 +570,11 @@ UPDATE_FLAG (sticky);
565570

566571
/**
567572
* Document-method: sticky_flag_iterator
573+
* call-seq: sticky_flag_iterator -> GettextPO::FlagIterator
574+
*
575+
* You may find it handy to use the #sticky_flag_iterator method to
576+
* iterate over the sticky flag. This is for more versatile
577+
* manipulation.
568578
*/
569579
FLAG_ITER (sticky);
570580
#endif

mrblib/mrb_gettextpo_common.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,28 @@ def file_positions
7676
end
7777
positions
7878
end
79+
80+
def each_sticky_flag # yields: flag
81+
iter = sticky_flag_iterator
82+
while true
83+
begin
84+
yield iter.next
85+
rescue StopIteration
86+
return
87+
end
88+
end
89+
end
90+
91+
def each_workflow_flag # yields: flag
92+
iter = workflow_flag_iterator
93+
while true
94+
begin
95+
yield iter.next
96+
rescue StopIteration
97+
return
98+
end
99+
end
100+
end
79101
end
80102

81103
class File

0 commit comments

Comments
 (0)