Module: Alf::Lang::Lispy::OwnMethods
- Defined in:
- lib/alf-lang/alf/lang/lispy.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #connection! ⇒ Object
- #parse(expr = nil, path = nil, line = nil, &block) ⇒ Object
- #to_s ⇒ Object (also: #inspect)
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
17 18 19 |
# File 'lib/alf-lang/alf/lang/lispy.rb', line 17 def connection @connection end |
Instance Method Details
#connection! ⇒ Object
19 20 21 |
# File 'lib/alf-lang/alf/lang/lispy.rb', line 19 def connection! connection.tap{|c| ::Kernel.raise(UnboundError, "#{self} not bound") unless c } end |
#parse(expr = nil, path = nil, line = nil, &block) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/alf-lang/alf/lang/lispy.rb', line 7 def parse(expr = nil, path = nil, line = nil, &block) if (expr && block) || (expr.nil? and block.nil?) raise ArgumentError, "Either `expr` or `block` should be specified" end expr = evaluate(expr, path, line, &block) if block or expr.is_a?(String) expr = __send__(expr) if expr.is_a?(Symbol) expr = expr.bind(connection) if expr.is_a?(Support::Bindable) && connection expr end |
#to_s ⇒ Object Also known as: inspect
23 24 25 26 27 28 29 30 |
# File 'lib/alf-lang/alf/lang/lispy.rb', line 23 def to_s mods = @extensions .map(&:name) .compact .reject{|x| x =~ /^Alf::|OwnMethods/} .join(',') "Lispy(#{mods})" end |