title: How to define a method once, but have it as both class method and instance method
body: <p>Is there any way to take an instance method and add it to the class (or vice versa)?</p>
  
  <p>Here's my attempt, but it fails because Ruby doesn't let me bind an instance method to the class:</p>
  
  <pre><code>#!/usr/bin/env ruby
  
  SOMETHING = :a
  class SomeClass
    def some_method(variable, value)
      case SOMETHING
      when :c
        "output for case C"
      when :a, :b
        "output for A or B"
      end
    end
    # here's my failed attampt to add some_method to SomeClass:
    self.instance_method(:some_method).bind(self)
  end
  
  # it works as an instance method
  bash = SomeClass.new
  puts bash.some_method("EDITOR","vim")
  
  # but not as a class method... yet
  puts SomeClass.some_method("EDITOR","vim")
  </code></pre>
  
  <p>The error is "bind argument must be an instance of SomeClass". In other words, I can't call <code>bind(self)</code> because <code>self</code> <em>is</em> the class rather than an instance of the class.</p>