Sha256: 4d9bba5e55a177277ab0e5d586eae4834a97c68084a5341d7c8b28c7dd733e41

Contents?: true

Size: 582 Bytes

Versions: 96

Compression:

Stored size: 582 Bytes

Contents

class Class # :nodoc:
  def class_inheritable_option(sym, default_value=nil)
    write_inheritable_attribute sym, default_value
    class_eval <<-EOS
      def self.#{sym}(value=nil)
        if !value.nil?
          write_inheritable_attribute(:#{sym}, value)
        else
          read_inheritable_attribute(:#{sym})
        end
      end
      
      def self.#{sym}=(value)
        write_inheritable_attribute(:#{sym}, value)
      end

      def #{sym}
        self.class.#{sym}
      end

      def #{sym}=(value)
        self.class.#{sym} = value
      end
    EOS
  end
end

Version data entries

96 entries across 96 versions & 28 rubygems

Version Path
jstorimer-deep-test-1.2.0 sample_rails_project/vendor/rails/actionwebservice/lib/action_web_service/support/class_inheritable_options.rb
jstorimer-deep-test-1.1.0 sample_rails_project/vendor/rails/actionwebservice/lib/action_web_service/support/class_inheritable_options.rb
jstorimer-deep-test-1.0.0 sample_rails_project/vendor/rails/actionwebservice/lib/action_web_service/support/class_inheritable_options.rb
jstorimer-deep-test-0.2.0 sample_rails_project/vendor/rails/actionwebservice/lib/action_web_service/support/class_inheritable_options.rb
jstorimer-deep-test-0.1.0 sample_rails_project/vendor/rails/actionwebservice/lib/action_web_service/support/class_inheritable_options.rb
actionwebservice-0.6.1 lib/action_web_service/support/class_inheritable_options.rb
actionwebservice-0.5.0 lib/action_web_service/support/class_inheritable_options.rb
actionwebservice-0.6.0 lib/action_web_service/support/class_inheritable_options.rb
actionwebservice-0.6.2 lib/action_web_service/support/class_inheritable_options.rb
actionservice-0.3.0 lib/action_service/support/class_inheritable_options.rb
actionwebservice-0.7.1 lib/action_web_service/support/class_inheritable_options.rb
actionwebservice-0.7.0 lib/action_web_service/support/class_inheritable_options.rb
actionwebservice-1.1.0 lib/action_web_service/support/class_inheritable_options.rb
actionwebservice-0.8.1 lib/action_web_service/support/class_inheritable_options.rb
actionwebservice-0.9.4 lib/action_web_service/support/class_inheritable_options.rb
actionwebservice-1.0.0 lib/action_web_service/support/class_inheritable_options.rb
actionwebservice-0.8.0 lib/action_web_service/support/class_inheritable_options.rb
actionwebservice-0.9.1 lib/action_web_service/support/class_inheritable_options.rb
actionwebservice-0.9.2 lib/action_web_service/support/class_inheritable_options.rb
actionwebservice-0.9.3 lib/action_web_service/support/class_inheritable_options.rb