Class: CsvRecord::Callback

Inherits:
Object show all
Defined in:
lib/csv_record/callback.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kind, code) ⇒ Callback



4
5
6
7
# File 'lib/csv_record/callback.rb', line 4

def initialize(kind, code)
  self.kind = kind
  self.code = code
end

Instance Attribute Details

#codeObject

Returns the value of attribute code.



2
3
4
# File 'lib/csv_record/callback.rb', line 2

def code
  @code
end

#kindObject

Returns the value of attribute kind.



2
3
4
# File 'lib/csv_record/callback.rb', line 2

def kind
  @kind
end

Instance Method Details

#run_on(obj) ⇒ Object



9
10
11
# File 'lib/csv_record/callback.rb', line 9

def run_on(obj)
  obj.instance_eval &self.code
end