Module: Plato::Repo::Sanitize

Extended by:
Sanitize
Included in:
Sanitize
Defined in:
lib/plato/repo.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, value) ⇒ Object



186
187
188
189
# File 'lib/plato/repo.rb', line 186

def method_missing(method, value)
  warn "Warning: not sanitizing #{method}."
  value.to_s
end

Instance Method Details

#body(body) ⇒ Object



182
183
184
# File 'lib/plato/repo.rb', line 182

def body(body)
  body # do we really need to do anything here?
end

#header(header_val) ⇒ Object



174
175
176
# File 'lib/plato/repo.rb', line 174

def header(header_val)
  header_val.gsub(/(\r|\n)/) {|m| {"\r" => '\r', "\n" => '\n'}[m] }
end

#path_elem(elem) ⇒ Object



178
179
180
# File 'lib/plato/repo.rb', line 178

def path_elem(elem)
  elem.to_s.gsub(/\s+/, '_').gsub(/[^a-zA-Z0-9_-]/,'')
end