Class: BenchBloc::Bloc::Task

Inherits:
BenchBloc::Bloc show all
Defined in:
lib/bench_bloc/bloc/bloc_task.rb

Instance Attribute Summary collapse

Attributes inherited from BenchBloc::Bloc

#bloc_hash, #bloc_namespaces

Instance Method Summary collapse

Methods inherited from BenchBloc::Bloc

#[], #generate_bloc, #rake_bloc

Constructor Details

#initialize(namespace, bloc_task) ⇒ Task

Returns a new instance of Task.



12
13
14
15
16
# File 'lib/bench_bloc/bloc/bloc_task.rb', line 12

def initialize namespace, bloc_task
  super(bloc_task)
  @namespace = namespace
  parse_bloc_task bloc_task
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



4
5
6
# File 'lib/bench_bloc/bloc/bloc_task.rb', line 4

def description
  @description
end

#labelObject (readonly)

Returns the value of attribute label.



4
5
6
# File 'lib/bench_bloc/bloc/bloc_task.rb', line 4

def label
  @label
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



4
5
6
# File 'lib/bench_bloc/bloc/bloc_task.rb', line 4

def namespace
  @namespace
end

#profileObject (readonly)

Returns the value of attribute profile.



4
5
6
# File 'lib/bench_bloc/bloc/bloc_task.rb', line 4

def profile
  @profile
end

#titleObject (readonly)

Returns the value of attribute title.



4
5
6
# File 'lib/bench_bloc/bloc/bloc_task.rb', line 4

def title
  @title
end

#to_profileObject (readonly)

Returns the value of attribute to_profile.



4
5
6
# File 'lib/bench_bloc/bloc/bloc_task.rb', line 4

def to_profile
  @to_profile
end

Instance Method Details

#rake_taskObject



18
19
20
21
22
23
24
25
26
# File 'lib/bench_bloc/bloc/bloc_task.rb', line 18

def rake_task
  desc description
  task namespace => :environment do
    BenchBloc::Logger.new(run_benchmark, description).log_results
    BenchBloc::Logger::RubyProf
      .new(run_ruby_prof, description)
      .log_results if @ruby_prof == true
  end
end