Sha256: f8329157755e42691c96135cf13a3db4a446ace3d2f828cc3c4218ac9a8460f0

Contents?: true

Size: 490 Bytes

Versions: 9

Compression:

Stored size: 490 Bytes

Contents

module Mirage
  module Helpers
    module MethodBuilder
      def builder_methods *method_names

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

      end
      alias builder_method builder_methods
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
mirage-3.0.12 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.11 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.10 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.9 lib/mirage/client/helpers/method_builder.rb
mirage-on-thin-3.0.8 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.8 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.7 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.6 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.5 lib/mirage/client/helpers/method_builder.rb