Module: TencentTrustsql::IOFormatter

Included in:
TencentTrustsql
Defined in:
lib/tencent_trustsql/i_o_formatter.rb,
lib/tencent_trustsql/i_o_formatter/input.rb,
lib/tencent_trustsql/i_o_formatter/output.rb

Defined Under Namespace

Classes: Input, Output

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.input_formatterObject (readonly)

Returns the value of attribute input_formatter.



7
8
9
# File 'lib/tencent_trustsql/i_o_formatter.rb', line 7

def input_formatter
  @input_formatter
end

.output_formatterObject (readonly)

Returns the value of attribute output_formatter.



7
8
9
# File 'lib/tencent_trustsql/i_o_formatter.rb', line 7

def output_formatter
  @output_formatter
end

Class Method Details

.included(base) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/tencent_trustsql/i_o_formatter.rb', line 9

def included base
  # 初始化转换器
  instance_variable_set '@input_formatter', instance_variable_get('@input_formatter') || Input.new
  instance_variable_set '@output_formatter', instance_variable_get('@output_formatter') || Output.new


  # mixing类转换器指向已初始化的转换器并提供读方法
  base.instance_variable_set '@input_formatter', input_formatter
  base.instance_variable_set '@output_formatter', output_formatter
  base.singleton_class.class_eval do
    attr_reader :input_formatter, :output_formatter
  end
end