Sha256: b2cec7bda43e079806430e913de6fb7c325aa9416b9b59d4767db32a04cf065a

Contents?: true

Size: 489 Bytes

Versions: 19

Compression:

Stored size: 489 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) unless arg
            instance_variable_set("@#{method_name}".to_sym, arg)
            self
          end
        end

      end
      alias builder_method builder_methods
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
mirage-3.0.4 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.3 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.2 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.1 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.0 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.0.alpha.17 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.0.alpha.16 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.0.alpha.15 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.0.alpha.14 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.0.alpha.13 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.0.alpha.12 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.0.alpha.11 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.0.alpha.10 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.0.alpha.9 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.0.alpha.8 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.0.alpha.7 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.0.alpha.6 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.0.alpha.5 lib/mirage/client/helpers/method_builder.rb
mirage-3.0.0.alpha.4 lib/mirage/client/helpers/method_builder.rb