Module: CouchVisible::ModelClassMethods

Defined in:
lib/couch_visible/couch_visible.rb

Instance Method Summary collapse

Instance Method Details

#count_hiddenObject



51
52
53
54
# File 'lib/couch_visible/couch_visible.rb', line 51

def count_hidden
  result = by_hidden(:reduce => true)['rows'].first
  result ? result['value'] : 0
end

#count_shownObject



56
57
58
59
# File 'lib/couch_visible/couch_visible.rb', line 56

def count_shown
  result = by_shown(:reduce => true)['rows'].first
  result ? result['value'] : 0
end

#hide_by_default!Object



47
48
49
# File 'lib/couch_visible/couch_visible.rb', line 47

def hide_by_default!
  @show_by_default = false
end

#hide_by_default?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/couch_visible/couch_visible.rb', line 43

def hide_by_default?
  !show_by_default?
end

#show_by_default!Object



39
40
41
# File 'lib/couch_visible/couch_visible.rb', line 39

def show_by_default!
  @show_by_default = true
end

#show_by_default?Boolean

Returns:

  • (Boolean)


31
32
33
34
35
36
37
# File 'lib/couch_visible/couch_visible.rb', line 31

def show_by_default?
  unless defined? @show_by_default
    CouchVisible.show_by_default?
  else
    @show_by_default
  end
end