Module: MotionBlender::Source::GlobalConstants

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

Instance Method Summary collapse

Instance Method Details

#find_global_constantsObject



13
14
15
16
17
18
19
20
21
# File 'lib/motion_blender/source/global_constants.rb', line 13

def find_global_constants
  if like_module?
    if children.first.type.const?
      children.first.code.split('::', 2).first
    end
  else
    children.compact.map(&:find_global_constants)
  end
end

#global_constantsObject



4
5
6
7
8
9
10
11
# File 'lib/motion_blender/source/global_constants.rb', line 4

def global_constants
  @global_constants ||=
    if root?
      Array.wrap(find_global_constants).flatten.compact.uniq
    else
      root.global_constants
    end
end