Skip to content

Commit

Permalink
Implement Literal#english? to aid matching English literals.
Browse files Browse the repository at this point in the history
  • Loading branch information
artob committed Jun 7, 2024
1 parent f5dd4e8 commit 55afa63
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/rdf/model/literal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,16 @@ def valid?
false
end

##
# Returns `true` if this is a language-tagged literal in the English
# language.
#
# @return [Boolean] `true` or `false`
# @since 3.3.2
def english?
/\Aen(?:-[A-Za-z]{2})?\z/ === language.to_s
end

##
# Validates the value using {RDF::Value#valid?}, raising an error if the value is
# invalid.
Expand Down

0 comments on commit 55afa63

Please sign in to comment.