Class: Jpmobile::HankakuFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/jpmobile/filter.rb

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (HankakuFilter) initialize(options = {})

Returns a new instance of HankakuFilter



68
69
70
71
72
73
74
# File 'lib/jpmobile/filter.rb', line 68

def initialize(options = {})
  @options = {
    :input => false,
  }.merge(options)

  @controller = nil
end

Class Method Details

+ (Object) hankaku_format(str)



48
49
50
# File 'lib/jpmobile/filter.rb', line 48

def hankaku_format(str)
  replace_chars(str, zen_to_han_table)
end

+ (Object) zenkaku_format(str)



52
53
54
# File 'lib/jpmobile/filter.rb', line 52

def zenkaku_format(str)
  replace_chars(str, han_to_zen_table)
end

Instance Method Details

- (Object) after(controller)

内部コードから外部コードに変換



86
87
88
89
90
91
# File 'lib/jpmobile/filter.rb', line 86

def after(controller)
  @controller = controller
  if apply_outgoing? and @controller.response.body.is_a?(String)
    @controller.response.body = to_external(@controller.response.body)
  end
end

- (Object) before(controller)



76
77
78
79
80
81
82
83
# File 'lib/jpmobile/filter.rb', line 76

def before(controller)
  @controller = controller
  if apply_incoming?
    Util.deep_apply(@controller.params) do |value|
      value = to_internal(value)
    end
  end
end