Module: SmoothOperator::ResourceName

Included in:
OpenStruct
Defined in:
lib/smooth_operator/resource_name.rb

Instance Method Summary collapse

Instance Method Details

#custom_model_nameObject



22
23
24
# File 'lib/smooth_operator/resource_name.rb', line 22

def custom_model_name
  get_option :model_name, nil
end

#model_nameObject



12
13
14
15
16
17
18
19
20
# File 'lib/smooth_operator/resource_name.rb', line 12

def model_name
  return '' if custom_model_name == :none

  if defined? ActiveModel
    smooth_model_name
  else
    custom_model_name ||= name.split('::').last.underscore.capitalize
  end
end

#resource_nameObject



8
9
10
# File 'lib/smooth_operator/resource_name.rb', line 8

def resource_name
  get_option :resource_name, self.model_name.to_s.underscore
end

#resources_nameObject



4
5
6
# File 'lib/smooth_operator/resource_name.rb', line 4

def resources_name
  get_option :resources_name, self.resource_name.pluralize
end