class Glob::Map

Public Class Methods

call(target) click to toggle source
# File lib/glob/map.rb, line 5
def self.call(target)
  new(target).call
end
new(target) click to toggle source
# File lib/glob/map.rb, line 9
def initialize(target)
  @keys = []
  @target = target
end

Public Instance Methods

call() click to toggle source
# File lib/glob/map.rb, line 14
def call
  @target
    .map {|(key, value)| compute(value, key) }
    .flatten
    .sort
end

Private Instance Methods

compute(value, path) click to toggle source
# File lib/glob/map.rb, line 21
        def compute(value, path)
  if value.is_a?(Hash)
    value.map do |key, other_value|
      compute(other_value, "#{path}.#{key}")
    end
  else
    path.to_s
  end
end