Module: AmberComponent::Helpers::ClassHelper

Included in:
Base
Defined in:
lib/amber_component/helpers/class_helper.rb

Overview

Adds class-specific utilities.

Instance Method Summary collapse

Instance Method Details

#const_nameString

Name of the constant this class/module is saved in (in the parent module).

Returns:

  • (String)


10
11
12
# File 'lib/amber_component/helpers/class_helper.rb', line 10

def const_name
  name.split('::').last
end

#source_locationArray(String, Integer), Array(Boolean, Integer)

Get the exact place where this class/module has been defined.

Returns:

  • (Array(String, Integer), Array(Boolean, Integer))

    File path followed by line number.



17
18
19
# File 'lib/amber_component/helpers/class_helper.rb', line 17

def source_location
  module_parent.const_source_location const_name
end