To answer the actual question: there is no succinct way to combine these 2 operations without constructing another object.
For example: Array and Enumerable#any? are very similar to what you are doing
chapters = ["1.0","2.0","3.0","4.0","5.0"]
chapters.any? {|n| n == number}
This is essentially: chapters[0] == number || chapters[1] == number #...
However
Assuming your formatting is "chapter.subchapter" where chapter is a number and subchapter == "0" indicates "Chapter".
I would go with the following as it would be independent of the "number" of Chapters
hierarchy = "Chapter" if number.match?(/\A\d+\.0\z/)
This compares number with the Regexp, which in words is "String starts with one or more numbers followed by a period followed by 0 and the end of the String".
e.g.
def chapter_hierarchy(number)
"Chapter" if number.match?(/\A\d+\.0\z/)
end
["1.0","1.1","2.0","2.01","3.0", "47.0010", "52.0", "A.0"].map {|n| [n,chapter_hierarchy(n)] }
#=> [["1.0", "Chapter"],
# ["1.1", nil],
# ["2.0", "Chapter"],
# ["2.01", nil],
# ["3.0", "Chapter"],
# ["47.0010", nil],
# ["52.0", "Chapter"]
# ["A.0", nil]]