module Mirage::Helpers::MethodBuilder

Public Instance Methods

builder_method(*method_names)
Alias for: builder_methods
builder_methods(*method_names) click to toggle source
# File lib/mirage/client/helpers/method_builder.rb, line 4
def builder_methods *method_names

  defaulted = Object.new

  method_names.each do |method_name|
    method_name = method_name.to_sym
    define_method method_name do |arg = defaulted|
      return instance_variable_get("@#{method_name}".to_sym) if arg == defaulted
      instance_variable_set("@#{method_name}".to_sym, arg)
      self
    end
  end

end
Also aliased as: builder_method