Sha256: 24f9465183ba7526a55caa9336d149abee808d225352d2b9a7e77f09866e9031

Contents?: true

Size: 471 Bytes

Versions: 26

Compression:

Stored size: 471 Bytes

Contents

# -*- coding: utf-8 -*-
require 'smalruby/hardware'
require 'delegate'

module Smalruby
  module Hardware
    # 何もしないハードウェアを表現するクラス
    class NullHardware
      def initialize(*_)
      end

      def method_missing(*_name)
        @null ||= NullHardware.new
      end

      %i(& ^ nil? to_a to_f to_i to_s |).each do |sym|
        define_method sym do |*args|
          nil.send(sym, *args)
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
smalruby-0.1.11-x86-mingw32 lib/smalruby/hardware/null_hardware.rb
smalruby-0.1.11 lib/smalruby/hardware/null_hardware.rb
smalruby-0.1.10-x86-mingw32 lib/smalruby/hardware/null_hardware.rb
smalruby-0.1.10 lib/smalruby/hardware/null_hardware.rb
smalruby-0.1.9-x86-mingw32 lib/smalruby/hardware/null_hardware.rb
smalruby-0.1.9 lib/smalruby/hardware/null_hardware.rb
smalruby-0.1.8-x86-mingw32 lib/smalruby/hardware/null_hardware.rb
smalruby-0.1.8 lib/smalruby/hardware/null_hardware.rb
smalruby-0.1.7-x86-mingw32 lib/smalruby/hardware/null_hardware.rb
smalruby-0.1.7 lib/smalruby/hardware/null_hardware.rb
smalruby-0.1.6-x86-mingw32 lib/smalruby/hardware/null_hardware.rb
smalruby-0.1.6 lib/smalruby/hardware/null_hardware.rb
smalruby-0.1.5-x86-mingw32 lib/smalruby/hardware/null_hardware.rb
smalruby-0.1.5 lib/smalruby/hardware/null_hardware.rb
smalruby-0.1.4-x86-mingw32 lib/smalruby/hardware/null_hardware.rb
smalruby-0.1.4 lib/smalruby/hardware/null_hardware.rb
smalruby-0.1.3-x86-mingw32 lib/smalruby/hardware/null_hardware.rb
smalruby-0.1.3 lib/smalruby/hardware/null_hardware.rb
smalruby-0.1.2-x86-mingw32 lib/smalruby/hardware/null_hardware.rb
smalruby-0.1.2 lib/smalruby/hardware/null_hardware.rb