Sha256: ace30937406efc412e2349120ffa41bfe63fd002a0d5a389b04c3c569c4832bb

Contents?: true

Size: 1.08 KB

Versions: 12

Compression:

Stored size: 1.08 KB

Contents

# encoding: utf-8

module BitBucket
  class API

    # Returns all API public methods for a given class.
    def self.inherited(klass)
      klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
        def self.actions
          self.new.api_methods_in(#{klass})
        end
        def actions
          api_methods_in(#{klass})
        end
      RUBY_EVAL
      super
    end

    def api_methods_in(klass)
      puts "---"
      (klass.send(:instance_methods, false) - ['actions']).sort.each do |method|
        puts "|--> #{method}"
      end
      klass.included_modules.each do |mod|
        if mod.to_s =~ /#{klass}/
          puts "| \\ #{mod.to_s}"
          mod.instance_methods(false).each do |met|
            puts "|  |--> #{met}"
          end
          puts "| /"
        end
      end
      puts "---"
      nil
    end

    def append_arguments(method)
      _method = self.method(method)
      if _method.arity == 0
        args = "()"
      elsif _method.arity > 0
        args = "(few)"
      else
        args = "(else)"
      end
      args
    end

  end # API
end # BitBucket

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
codenamev_bitbucket_api-0.4.1 lib/bitbucket_rest_api/api/actions.rb
codenamev_bitbucket_api-0.4.0 lib/bitbucket_rest_api/api/actions.rb
bitbucket_rest_api-0.1.7 lib/bitbucket_rest_api/api/actions.rb
reenhanced_bitbucket_api-0.3.2 lib/bitbucket_rest_api/api/actions.rb
reenhanced_bitbucket_api-0.3.1 lib/bitbucket_rest_api/api/actions.rb
reenhanced_bitbucket_api-0.3.0 lib/bitbucket_rest_api/api/actions.rb
reenhanced_bitbucket_api-0.1.6 lib/bitbucket_rest_api/api/actions.rb
bitbucket_rest_api-0.1.5 lib/bitbucket_rest_api/api/actions.rb
bitbucket_rest_api-0.1.4 lib/bitbucket_rest_api/api/actions.rb
bitbucket_rest_api-0.1.2 lib/bitbucket_rest_api/api/actions.rb
bitbucket_rest_api-0.1.1 lib/bitbucket_rest_api/api/actions.rb
bitbucket_rest_api-0.1.0 lib/bitbucket_rest_api/api/actions.rb