Sha256: aeb7e48a850486b7b4eaf93c3b6a1632592cb750d0da2460213dc598afe1061e

Contents?: true

Size: 413 Bytes

Versions: 1

Compression:

Stored size: 413 Bytes

Contents

class Nydp::Builtin::Plus
  include Nydp::Builtin::Base, Singleton

  def name ; "+" ; end

  def builtin_call *args
    if args.empty?
      0
    else
      case args.first
      when String
        args.each_with_object("") { |str, res| res << str.to_s }
      when Date
        (args.shift._nydp_date + builtin_call(*args)).to_ruby
      else
        args.reduce &:+
      end
    end._nydp_wrapper
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nydp-0.6.0 lib/nydp/builtin/plus.rb