Class: Mybatis::Generate::GenerateContext
- Inherits:
-
Object
- Object
- Mybatis::Generate::GenerateContext
- Defined in:
- lib/mybatis/util/context.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#mapper_package ⇒ Object
Returns the value of attribute mapper_package.
-
#package ⇒ Object
Returns the value of attribute package.
-
#po_name ⇒ Object
Returns the value of attribute po_name.
-
#table_name ⇒ Object
Returns the value of attribute table_name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ GenerateContext
constructor
A new instance of GenerateContext.
- #join_package_and_po_name ⇒ Object
Constructor Details
#initialize ⇒ GenerateContext
Returns a new instance of GenerateContext.
45 46 47 48 |
# File 'lib/mybatis/util/context.rb', line 45 def initialize self.package = '' self.attributes = [] end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
25 26 27 |
# File 'lib/mybatis/util/context.rb', line 25 def attributes @attributes end |
#mapper_package ⇒ Object
Returns the value of attribute mapper_package.
22 23 24 |
# File 'lib/mybatis/util/context.rb', line 22 def mapper_package @mapper_package end |
#package ⇒ Object
Returns the value of attribute package.
21 22 23 |
# File 'lib/mybatis/util/context.rb', line 21 def package @package end |
#po_name ⇒ Object
Returns the value of attribute po_name.
23 24 25 |
# File 'lib/mybatis/util/context.rb', line 23 def po_name @po_name end |
#table_name ⇒ Object
Returns the value of attribute table_name.
24 25 26 |
# File 'lib/mybatis/util/context.rb', line 24 def table_name @table_name end |
Class Method Details
.instance_with_options(options) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/mybatis/util/context.rb', line 28 def #{"package"=>"package", "name"=>"Order", "tablename"=>"t_order", "list"=>["id", "order_no", "create_time"]} p context = self.new context.package = [:package] context.mapper_package = [:mapper_package] context.po_name = [:name].upcase_first context.table_name = [:tablename] != '' ? [:tablename] : "t#{context.po_name.replace_upcase_to_underline}" for str in [:list] attr = Mybatis::Generate::Attribute. str context.attributes << attr end context end |
Instance Method Details
#join_package_and_po_name ⇒ Object
50 51 52 53 |
# File 'lib/mybatis/util/context.rb', line 50 def join_package_and_po_name return "#{self.package}.#{self.po_name}" if self.package "#{self.po_name}" end |