Class: DRG::Ruby::Func

Inherits:
Struct
  • Object
show all
Defined in:
lib/drg/ruby/func.rb

Direct Known Subclasses

ClassFunc, InstanceFunc

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#_privateObject Also known as: private?

Returns the value of attribute _private

Returns:

  • (Object)

    the current value of _private



1
2
3
# File 'lib/drg/ruby/func.rb', line 1

def _private
  @_private
end

#sexpObject

Returns the value of attribute sexp

Returns:

  • (Object)

    the current value of sexp



1
2
3
# File 'lib/drg/ruby/func.rb', line 1

def sexp
  @sexp
end

Instance Method Details

#conditionsObject



4
5
6
7
8
# File 'lib/drg/ruby/func.rb', line 4

def conditions
  DRG::Decorators::SexpDecorator.new(sexp).each_sexp_condition.map do |exp|
    DRG::Ruby::Condition.new(exp)
  end
end

#map_args(_sexp = sexp, list = []) ⇒ Object

Note:

we drop(1) to get rid of :args (which should be the first item in the sexp)



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/drg/ruby/func.rb', line 11

def map_args(_sexp = sexp, list = [])
  val = _sexp.first
  return list.drop(1) unless val
  case val
  when Symbol
    map_args(_sexp.drop(1), list << val)
  when Sexp
    map_args(_sexp.drop(1), list << val[1])
  else
    nil
  end
end