Class: Ldpath::LanguageTest

Inherits:
TestSelector show all
Defined in:
lib/ldpath/tests.rb

Instance Attribute Summary collapse

Attributes inherited from TestSelector

#delegate, #test

Instance Method Summary collapse

Methods inherited from Selector

#loading

Constructor Details

#initialize(lang) ⇒ LanguageTest

Returns a new instance of LanguageTest.



30
31
32
33
34
# File 'lib/ldpath/tests.rb', line 30

def initialize(lang)
  @lang = lang

  super
end

Instance Attribute Details

#langObject (readonly)

Returns the value of attribute lang.



28
29
30
# File 'lib/ldpath/tests.rb', line 28

def lang
  @lang
end

Instance Method Details

#evaluate(_program, uri, _context) ⇒ Object



36
37
38
39
40
# File 'lib/ldpath/tests.rb', line 36

def evaluate(_program, uri, _context)
  return unless uri.literal?

  uri if (lang.to_s == "none" && !uri.has_language?) || uri.language.to_s == lang.to_s
end