Class: Xlsx2Mysql::Relative
- Inherits:
-
Object
- Object
- Xlsx2Mysql::Relative
show all
- Defined in:
- lib/xlsx2mysql/relative.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(name = nil, &block) ⇒ Relative
Returns a new instance of Relative.
5
6
7
8
9
|
# File 'lib/xlsx2mysql/relative.rb', line 5
def initialize(name = nil, &block)
@fields_hash = {}
instance_eval(&block)
run
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
34
35
36
37
38
39
40
|
# File 'lib/xlsx2mysql/relative.rb', line 34
def method_missing(name, *args)
if name =~ /[A-Z]+/
Column.new(name, args[0])
else
super
end
end
|
Instance Attribute Details
#fields_hash ⇒ Object
Returns the value of attribute fields_hash.
3
4
5
|
# File 'lib/xlsx2mysql/relative.rb', line 3
def fields_hash
@fields_hash
end
|
Instance Method Details
#associate(&block) ⇒ Object
30
31
32
|
# File 'lib/xlsx2mysql/relative.rb', line 30
def associate(&block)
instance_eval(&block)
end
|
#mysql(&block) ⇒ Object
15
16
17
18
|
# File 'lib/xlsx2mysql/relative.rb', line 15
def mysql(&block)
mysql_ref.configure(&block)
define_methods_with_field_name
end
|
#mysql_ref ⇒ Object
11
12
13
|
# File 'lib/xlsx2mysql/relative.rb', line 11
def mysql_ref
@mysql_ref ||= MysqlController.new
end
|
#xlsx(&block) ⇒ Object
Also known as:
excel
24
25
26
|
# File 'lib/xlsx2mysql/relative.rb', line 24
def xlsx(&block)
xlsx_ref.configure(&block)
end
|
#xlsx_ref ⇒ Object
20
21
22
|
# File 'lib/xlsx2mysql/relative.rb', line 20
def xlsx_ref
@xlsx_ref ||= XlsxController.new
end
|