class BenchBloc::Bloc

Responsible for generating rake tasks from a hash and/or creating child Blocs

Attributes

bloc_hash[RW]
bloc_namespaces[RW]

Public Class Methods

new(bloc_hash) click to toggle source
# File lib/bench_bloc/bloc/bloc.rb, line 7
def initialize bloc_hash
  @bloc_hash, @bloc_namespaces = bloc_hash, []
end

Public Instance Methods

[](namespace_key) click to toggle source
# File lib/bench_bloc/bloc/bloc.rb, line 27
def [](namespace_key)
  bench_bloc_namespace
    .bloc_namespaces
    .find { |bn| namespace_key == bn.namespace_key }
end
generate_bloc() click to toggle source
# File lib/bench_bloc/bloc/bloc.rb, line 11
def generate_bloc
  bloc_namespaces.push(
    Bloc::Namespace.new(
      :bench_bloc,
      bloc_hash,
      true
    )
  )
end
rake_bloc() click to toggle source
# File lib/bench_bloc/bloc/bloc.rb, line 21
def rake_bloc
  bloc_namespaces.each do |bn|
    bn.rake_namespace
  end
end

Private Instance Methods

bench_bloc_namespace() click to toggle source
# File lib/bench_bloc/bloc/bloc.rb, line 38
def bench_bloc_namespace
  bloc_namespaces[0]
end
is_task?(obj) click to toggle source
# File lib/bench_bloc/bloc/bloc.rb, line 34
def is_task? obj
  obj.keys.any?(:profile)
end