module BELParser::Language::Function

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.

Public Instance Methods

===(other) click to toggle source
# File lib/bel_parser/language/function.rb, line 38
def ===(other)
  return false if other.nil?
  short == other || long == other
end
=~(regexp) click to toggle source
# File lib/bel_parser/language/function.rb, line 63
def =~(regexp)
  short =~ regexp || long =~ regexp
end
deprecated?() click to toggle source

Indicates whether this function is deprecated. Override in your function to mark as deprecated.

@return [Boolean] false

# File lib/bel_parser/language/function.rb, line 34
def deprecated?
  false
end
description() click to toggle source
# File lib/bel_parser/language/function.rb, line 22
def description
  raise NotImplementedError, "#{__method__} is not implemented."
end
long() click to toggle source
# File lib/bel_parser/language/function.rb, line 14
def long
  raise NotImplementedError, "#{__method__} is not implemented."
end
return_type() click to toggle source
# File lib/bel_parser/language/function.rb, line 18
def return_type
  raise NotImplementedError, "#{__method__} is not implemented."
end
short() click to toggle source
# File lib/bel_parser/language/function.rb, line 10
def short
  raise NotImplementedError, "#{__method__} is not implemented."
end
signatures() click to toggle source
# File lib/bel_parser/language/function.rb, line 26
def signatures
  raise NotImplementedError, "#{__method__} is not implemented."
end
to_h(hash = {}) click to toggle source
# File lib/bel_parser/language/function.rb, line 53
def to_h(hash = {})
  hash.merge!({
    'short'       => short,
    'long'        => long,
    'return_type' => return_type.to_sym.to_s,
    'signatures'  => signatures.map { |sig| sig.string_form },
    'description' => description
  })
end
to_s(form = :short) click to toggle source
# File lib/bel_parser/language/function.rb, line 47
def to_s(form = :short)
  value = _form_value(form)
  return nil unless value
  value.to_s
end
to_sym(form = :short) click to toggle source
# File lib/bel_parser/language/function.rb, line 43
def to_sym(form = :short)
  _form_value(form)
end

Private Instance Methods

_form_value(form = :short) click to toggle source
# File lib/bel_parser/language/function.rb, line 69
def _form_value(form = :short)
  case form
  when :short
    short
  when :long
    long
  end
end