class Mybatis::Generate::GenerateContext

Attributes

attributes[RW]
mapper_package[RW]
package[RW]
po_name[RW]
table_name[RW]

Public Class Methods

instance_with_options(options) click to toggle source
# File lib/mybatis/util/context.rb, line 28
def instance_with_options options
  #{"package"=>"package", "name"=>"Order", "tablename"=>"t_order", "list"=>["id", "order_no", "create_time"]}
  p options
  context = self.new
  context.package = options[:package]
  context.mapper_package = options[:mapper_package]
  context.po_name = options[:name].upcase_first
  context.table_name =
      options[:tablename] != '' ? options[:tablename] : "t#{context.po_name.replace_upcase_to_underline}"
  for str in options[:list]
    attr = Mybatis::Generate::Attribute.instance_with_options str
    context.attributes << attr
  end
  context
end
new() click to toggle source
# File lib/mybatis/util/context.rb, line 45
def initialize
  self.package = ''
  self.attributes = []
end

Public Instance Methods

join_package_and_po_name() click to toggle source
# 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