Sha256: 80b716716c9004a870dcf9370b1de5db79141a2217f04423154d7cd9dbf1121f

Contents?: true

Size: 1.6 KB

Versions: 17

Compression:

Stored size: 1.6 KB

Contents

require 'inch/language/javascript/code_object/function_parameter_object'

module Inch
  module Language
    module JavaScript
      module CodeObject
        # Proxy class for functions
        class FunctionObject < Base
          def bang_name?
            self[:bang_name?]
          end

          def getter?
            self[:getter?]
          end

          def has_parameters?
            !parameters.empty?
          end

          MANY_PARAMETERS_THRESHOLD = 3
          def has_many_parameters?
            parameters.size > MANY_PARAMETERS_THRESHOLD
          end

          def has_many_lines?
            false
          end

          def parameter(name)
            parameters.find { |p| p.name == name.to_s }
          end

          def parameters
            @parameters ||= self[:parameters].map do |param_attr|
              FunctionParameterObject.new(param_attr)
            end
          end

          def overridden?
            self[:overridden?]
          end

          def overridden_method
            @overridden_method ||=
              object_lookup.find(self[:overridden_method_fullname])
          end

          def return_mentioned?
            self[:return_mentioned?]
          end

          def return_described?
            self[:return_described?]
          end

          def return_typed?
            self[:return_typed?]
          end

          def setter?
            self[:setter?]
          end

          def source
            self[:source?]
          end

          def questioning_name?
            self[:questioning_name?]
          end
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
inch-0.9.0.rc1 lib/inch/language/javascript/code_object/function_object.rb
inch-0.8.0 lib/inch/language/javascript/code_object/function_object.rb
inch-0.8.0.rc2 lib/inch/language/javascript/code_object/function_object.rb
inch-0.8.0.rc1 lib/inch/language/javascript/code_object/function_object.rb
inch-0.7.1 lib/inch/language/javascript/code_object/function_object.rb
inch-0.7.0 lib/inch/language/javascript/code_object/function_object.rb
inch-0.6.4 lib/inch/language/javascript/code_object/function_object.rb
inch-0.6.3 lib/inch/language/javascript/code_object/function_object.rb
inch-0.6.2 lib/inch/language/javascript/code_object/function_object.rb
inch-0.6.1 lib/inch/language/javascript/code_object/function_object.rb
inch-0.6.0 lib/inch/language/javascript/code_object/function_object.rb
inch-0.6.0.rc6 lib/inch/language/javascript/code_object/function_object.rb
inch-0.6.0.rc5 lib/inch/language/javascript/code_object/function_object.rb
inch-0.6.0.rc4 lib/inch/language/javascript/code_object/function_object.rb
inch-0.6.0.rc3 lib/inch/language/javascript/code_object/function_object.rb
inch-0.6.0.rc2 lib/inch/language/javascript/code_object/function_object.rb
inch-0.6.0.rc1 lib/inch/language/javascript/code_object/function_object.rb