Skip to content

Commit 55afa63

Browse files
committed
Implement Literal#english? to aid matching English literals.
1 parent f5dd4e8 commit 55afa63

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

lib/rdf/model/literal.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,16 @@ def valid?
451451
false
452452
end
453453

454+
##
455+
# Returns `true` if this is a language-tagged literal in the English
456+
# language.
457+
#
458+
# @return [Boolean] `true` or `false`
459+
# @since 3.3.2
460+
def english?
461+
/\Aen(?:-[A-Za-z]{2})?\z/ === language.to_s
462+
end
463+
454464
##
455465
# Validates the value using {RDF::Value#valid?}, raising an error if the value is
456466
# invalid.

0 commit comments

Comments
 (0)