Class: RakeFactory::ParameterView

Inherits:
Object
  • Object
show all
Defined in:
lib/rake_factory/parameter_view.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(task) ⇒ ParameterView

Returns a new instance of ParameterView.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rake_factory/parameter_view.rb', line 5

def initialize(task)
  self.instance_eval do
    task.class.parameter_set.each do |parameter|
      define_singleton_method parameter.reader_method do
        task.send(parameter.reader_method)
      end

      if parameter.configurable?
        define_singleton_method parameter.writer_method do |value|
          task.send(parameter.writer_method, value)
        end
      end
    end
  end
end

Instance Attribute Details

#taskObject (readonly)

Returns the value of attribute task.



3
4
5
# File 'lib/rake_factory/parameter_view.rb', line 3

def task
  @task
end