Sha256: d45824239ac51f40278945efd2358bfe3587c5d0f0a7deb86fdce10575d39a9c

Contents?: true

Size: 1.62 KB

Versions: 45

Compression:

Stored size: 1.62 KB

Contents

module BELParser
  module Language
    # Function allows you to describe the type of BEL Term.
    #
    # BEL Terms are composed of BEL Functions and entity definitions
    # referenced using BEL Namespace identifiers. Each BEL Term represents
    # either an abundance of a biological entity, the abundance of human AKT1
    # for example, or a biological process such as cardiomyopathy.
    module Function
      def short
        raise NotImplementedError, "#{__method__} is not implemented."
      end

      def long
        raise NotImplementedError, "#{__method__} is not implemented."
      end

      def return_type
        raise NotImplementedError, "#{__method__} is not implemented."
      end

      def description
        raise NotImplementedError, "#{__method__} is not implemented."
      end

      def signatures
        raise NotImplementedError, "#{__method__} is not implemented."
      end

      # Indicates whether this function is deprecated. Override in your
      # function to mark as deprecated.
      #
      # @return [Boolean] false
      def deprecated?
        false
      end

      def ===(other)
        return false if other.nil?
        short == other || long == other
      end

      def to_sym(form = :short)
        value = _form_value(form)
        return nil unless value
        value.to_s
      end

      def to_s(form = :short)
        value = _form_value(form)
        return nil unless value
        value.to_s
      end

      private

      def _form_value(form = :short)
        case form
        when :short
          short
        when :long
          long
        end
      end
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
bel_parser-1.0.0.alpha.37-java lib/bel_parser/language/function.rb
bel_parser-1.0.0.alpha.37 lib/bel_parser/language/function.rb
bel_parser-1.0.0.alpha.36-java lib/bel_parser/language/function.rb
bel_parser-1.0.0.alpha.36 lib/bel_parser/language/function.rb
bel_parser-1.0.0.alpha.35-java lib/bel_parser/language/function.rb
bel_parser-1.0.0.alpha.35 lib/bel_parser/language/function.rb
bel_parser-1.0.0.alpha.34-java lib/bel_parser/language/function.rb
bel_parser-1.0.0.alpha.34 lib/bel_parser/language/function.rb
bel_parser-1.0.0.alpha.32-java lib/bel_parser/language/function.rb
bel_parser-1.0.0.alpha.32 lib/bel_parser/language/function.rb
bel_parser-1.0.0.alpha.31-java lib/bel_parser/language/function.rb
bel_parser-1.0.0.alpha.31 lib/bel_parser/language/function.rb
bel_parser-1.0.0.alpha.30-java lib/bel_parser/language/function.rb
bel_parser-1.0.0.alpha.30 lib/bel_parser/language/function.rb
bel_parser-1.0.0.alpha.29-java lib/bel_parser/language/function.rb
bel_parser-1.0.0.alpha.29 lib/bel_parser/language/function.rb
bel_parser-1.0.0.alpha.28-java lib/bel_parser/language/function.rb
bel_parser-1.0.0.alpha.28 lib/bel_parser/language/function.rb
bel_parser-1.0.0.alpha.27-java lib/bel_parser/language/function.rb
bel_parser-1.0.0.alpha.27 lib/bel_parser/language/function.rb