Class: Plok::Search::Term

Inherits:
Object
  • Object
show all
Defined in:
lib/plok/search/term.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string, controller: nil) ⇒ Term

Returns a new instance of Term.



5
6
7
8
# File 'lib/plok/search/term.rb', line 5

def initialize(string, controller: nil)
  @string = string
  @controller = controller
end

Instance Attribute Details

#controllerObject (readonly)

Returns the value of attribute controller.



3
4
5
# File 'lib/plok/search/term.rb', line 3

def controller
  @controller
end

#stringObject (readonly)

Returns the value of attribute string.



3
4
5
# File 'lib/plok/search/term.rb', line 3

def string
  @string
end

Instance Method Details

#localeObject



10
11
12
13
# File 'lib/plok/search/term.rb', line 10

def locale
  return controller.locale if controller.present?
  :nl
end

#valid?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/plok/search/term.rb', line 15

def valid?
  @string.present?
end

#valueObject



19
20
21
# File 'lib/plok/search/term.rb', line 19

def value
  string
end