Module: Httpify::ClassMethods

Defined in:
lib/httpify.rb

Instance Method Summary collapse

Instance Method Details

#httpify(*args) ⇒ Object

Formats the variable

:args

The names of the variables to httpify

Optional parameters passed in as a hash

:https

Boolean - adds https

:trailing_slash

Boolean - adds a trailing slash



32
33
34
35
36
37
38
39
40
41
# File 'lib/httpify.rb', line 32

def httpify(*args)
  options = args.extract_options!

  args.each do |arg|
    define_method arg.to_sym do
      str = instance_variable_get("@#{arg}")
      str.httpify(options) unless !str.is_a?(String)
    end
  end
end