Class: Requested::Action

Inherits:
String
  • Object
show all
Defined in:
lib/requested/action.rb

Instance Method Summary collapse

Instance Method Details

#collection?Boolean



56
57
58
# File 'lib/requested/action.rb', line 56

def collection?
  self.index?
end

#create?Boolean



40
41
42
# File 'lib/requested/action.rb', line 40

def create?
  self == "create"
end

#destroy?Boolean



48
49
50
# File 'lib/requested/action.rb', line 48

def destroy?
  self == "destroy"
end

#edit?Boolean



32
33
34
# File 'lib/requested/action.rb', line 32

def edit?
  self == "edit"
end

#edit_or_update?Boolean



64
65
66
# File 'lib/requested/action.rb', line 64

def edit_or_update?
    %w(edit update).include? self
end

#index?Boolean



24
25
26
# File 'lib/requested/action.rb', line 24

def index?
  self == "index"
end

#new?Boolean



28
29
30
# File 'lib/requested/action.rb', line 28

def new?
  self == "new"
end

#new_or_create?Boolean



60
61
62
# File 'lib/requested/action.rb', line 60

def new_or_create?
    %w(new create).include? self
end

#rest?Boolean



20
21
22
# File 'lib/requested/action.rb', line 20

def rest?
  %w(index new create edit update destroy show).include? self
end

#show?Boolean



36
37
38
# File 'lib/requested/action.rb', line 36

def show?
  self == "show"
end

#single_object?Boolean



52
53
54
# File 'lib/requested/action.rb', line 52

def single_object?
  self.rest? && !self.index?
end

#update?Boolean



44
45
46
# File 'lib/requested/action.rb', line 44

def update?
  self == "update"
end