Module: MotionBlender::Source::WrappingModules

Included in:
MotionBlender::Source
Defined in:
lib/motion_blender/source/wrapping_modules.rb

Instance Method Summary collapse

Instance Method Details

#class_content?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/motion_blender/source/wrapping_modules.rb', line 19

def class_content?
  parent && parent.type.class? && (parent.children[2] == self)
end

#module_content?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/motion_blender/source/wrapping_modules.rb', line 15

def module_content?
  parent && parent.type.module? && (parent.children[1] == self)
end

#parent_moduleObject



9
10
11
12
13
# File 'lib/motion_blender/source/wrapping_modules.rb', line 9

def parent_module
  if module_content? || class_content?
    [parent.type.to_s, parent.children.first.code]
  end
end

#wrapping_modulesObject



4
5
6
7
# File 'lib/motion_blender/source/wrapping_modules.rb', line 4

def wrapping_modules
  @wrapping_modules ||=
    [*parent.try(:wrapping_modules), parent_module].compact
end