module RademadeAdmin::Hideable

Constants

STATUS_HIDDEN
STATUS_SHOWN

Public Instance Methods

hide() click to toggle source
# File lib/rademade_admin/hideable.rb, line 28
def hide
  send(:status=, STATUS_HIDDEN)
end
method_missing(name, *arguments) click to toggle source
Calls superclass method
# File lib/rademade_admin/hideable.rb, line 7
def method_missing(name, *arguments)
  if %w(status status=).include? name
    raise NotImplementedError.new "Implement '#{name}' method"
  end
  super
end
show() click to toggle source
# File lib/rademade_admin/hideable.rb, line 24
def show
  send(:status=, STATUS_SHOWN)
end
shown?() click to toggle source
# File lib/rademade_admin/hideable.rb, line 14
def shown?
  item_status = send(:status)
  if item_status.is_a? Fixnum
    item_status == STATUS_SHOWN
  else
    # for boolean values
    item_status
  end
end
toggle() click to toggle source
# File lib/rademade_admin/hideable.rb, line 32
def toggle
  shown? ? hide : show
end