Class: BenchBloc::Bloc
- Inherits:
-
Object
- Object
- BenchBloc::Bloc
- Includes:
- Rake::DSL
- Defined in:
- lib/bench_bloc/bloc/bloc.rb
Overview
Responsible for generating rake tasks from a hash and/or creating child Blocs
Defined Under Namespace
Instance Attribute Summary collapse
-
#bloc_hash ⇒ Object
Returns the value of attribute bloc_hash.
-
#bloc_namespaces ⇒ Object
Returns the value of attribute bloc_namespaces.
Instance Method Summary collapse
- #[](namespace_key) ⇒ Object
- #generate_bloc ⇒ Object
-
#initialize(bloc_hash) ⇒ Bloc
constructor
A new instance of Bloc.
- #rake_bloc ⇒ Object
Constructor Details
#initialize(bloc_hash) ⇒ Bloc
Returns a new instance of Bloc.
7 8 9 |
# File 'lib/bench_bloc/bloc/bloc.rb', line 7 def initialize bloc_hash @bloc_hash, @bloc_namespaces = bloc_hash, [] end |
Instance Attribute Details
#bloc_hash ⇒ Object
Returns the value of attribute bloc_hash.
6 7 8 |
# File 'lib/bench_bloc/bloc/bloc.rb', line 6 def bloc_hash @bloc_hash end |
#bloc_namespaces ⇒ Object
Returns the value of attribute bloc_namespaces.
6 7 8 |
# File 'lib/bench_bloc/bloc/bloc.rb', line 6 def bloc_namespaces @bloc_namespaces end |
Instance Method Details
#[](namespace_key) ⇒ Object
27 28 29 30 31 |
# 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 ⇒ Object
11 12 13 14 15 16 17 18 19 |
# 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 ⇒ Object
21 22 23 24 25 |
# File 'lib/bench_bloc/bloc/bloc.rb', line 21 def rake_bloc bloc_namespaces.each do |bn| bn.rake_namespace end end |