Class: ActionHero::ActionResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/action_hero/action_resolver.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ActionResolver

Returns a new instance of ActionResolver.



7
8
9
10
# File 'lib/action_hero/action_resolver.rb', line 7

def initialize( options )
  @module_name = normalize_controller( options )
  @action_name = options[:action_name]
end

Instance Attribute Details

#action_nameObject (readonly)

Returns the value of attribute action_name.



4
5
6
# File 'lib/action_hero/action_resolver.rb', line 4

def action_name
  @action_name
end

#module_nameObject (readonly)

Returns the value of attribute module_name.



4
5
6
# File 'lib/action_hero/action_resolver.rb', line 4

def module_name
  @module_name
end

Instance Method Details

#action_classObject



12
13
14
# File 'lib/action_hero/action_resolver.rb', line 12

def action_class
  @action_class ||= action_class_name.constantize
end

#action_class_file_exists?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/action_hero/action_resolver.rb', line 23

def action_class_file_exists?
  File.exists?( Rails.root.join( 'app', 'actions', "#{action_class_name.underscore}.rb" ))
end

#action_class_nameObject



16
17
18
19
20
21
# File 'lib/action_hero/action_resolver.rb', line 16

def action_class_name
  @action_class_name ||= [
    module_name,
    action_name.camelize
  ].join( '::' )
end