Class: Jpmobile::HankakuFilter

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ HankakuFilter



62
63
64
65
66
67
68
# File 'lib/jpmobile/filter.rb', line 62

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

  @controller = nil
end

Class Method Details

.hankaku_format(str) ⇒ Object



42
43
44
# File 'lib/jpmobile/filter.rb', line 42

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

.zenkaku_format(str) ⇒ Object



46
47
48
# File 'lib/jpmobile/filter.rb', line 46

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

Instance Method Details

#after(controller) ⇒ Object

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



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

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

#before(controller) ⇒ Object



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

def before(controller)
  @controller = controller

  if apply_incoming?
    @controller.params = convert_parameters(@controller.params.dup)
  end
end