Class: SearchFuAttributes

Inherits:
Array
  • Object
show all
Defined in:
lib/search_fu_attributes.rb

Defined Under Namespace

Classes: DuplicateViewName, NotSearchFuAttribute, ViewNameNotFound

Instance Method Summary collapse

Instance Method Details

#<<(value) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/search_fu_attributes.rb', line 8

def << value
  raise NotSearchFuAttribute if !value.kind_of? SearchFuAttribute
  if find value.view_name
    raise DuplicateViewName
  else
    super
  end
end

#find(view_name) ⇒ Object



21
22
23
# File 'lib/search_fu_attributes.rb', line 21

def find view_name
  self.detect { |t| t.view_name == view_name }
end

#find!(view_name) ⇒ Object

Raises:



25
26
27
28
29
# File 'lib/search_fu_attributes.rb', line 25

def find! view_name
  a = find view_name
  raise ViewNameNotFound unless a
  a
end

#view_namesObject



17
18
19
# File 'lib/search_fu_attributes.rb', line 17

def view_names
  self.map { |t| t.view_name }
end