Class: Brakeman::Messages::Input

Inherits:
Object
  • Object
show all
Defined in:
lib/brakeman/messages.rb

Instance Method Summary collapse

Constructor Details

#initialize(input) ⇒ Input

Returns a new instance of Input.



146
147
148
149
# File 'lib/brakeman/messages.rb', line 146

def initialize input
  @input = input
  @value = friendly_type_of(@input)
end

Instance Method Details

#friendly_type_of(input_type) ⇒ Object



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/brakeman/messages.rb', line 151

def friendly_type_of input_type
  if input_type.is_a? Brakeman::BaseCheck::Match
    input_type = input_type.type
  end

  case input_type
  when :params
    "parameter value"
  when :cookies
    "cookie value"
  when :request
    "request value"
  when :model
    "model attribute"
  else
    "user input"
  end
end

#to_htmlObject



174
175
176
# File 'lib/brakeman/messages.rb', line 174

def to_html
  self.to_s
end

#to_sObject



170
171
172
# File 'lib/brakeman/messages.rb', line 170

def to_s
  @value
end