File: define_implicit_conversions.rb

package info (click to toggle)
ruby-naught 1.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 276 kB
  • sloc: ruby: 1,091; makefile: 6
file content (31 lines) | stat: -rw-r--r-- 582 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require 'naught/null_class_builder/command'

module Naught
  class NullClassBuilder
    module Commands
      class DefineImplicitConversions < ::Naught::NullClassBuilder::Command
        def call
          defer do |subject|
            subject.module_eval do
              def to_ary
                []
              end

              def to_hash
                {}
              end

              def to_int
                0
              end

              def to_str
                ''
              end
            end
          end
        end
      end
    end
  end
end