eac_ruby_utils 0.90.0 → 0.92.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/eac_ruby_utils/bit_array.rb +7 -0
- data/lib/eac_ruby_utils/byte.rb +14 -2
- data/lib/eac_ruby_utils/byte_array.rb +1 -1
- data/lib/eac_ruby_utils/envs/process.rb +12 -4
- data/lib/eac_ruby_utils/patches/object/asserts.rb +11 -0
- data/lib/eac_ruby_utils/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 8de300b93d07c47da4a3d924293ad423cf59e56278812ee2c02e6060f0b32de0
         | 
| 4 | 
            +
              data.tar.gz: 43c29306043eba3bdc3eba1c668a377b9a37fc9f108a1d14c5f106631a30bf1d
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 75858a212a0efc521ba2e7b284e895d2f1ade46c0536489f92b6b93085ecaf4673b68f0ab803f3c71c7f4efd32a41f2a323be66b330a2bd30ba26568027c3b52
         | 
| 7 | 
            +
              data.tar.gz: 6fff23095dbbe059107b0051d91e7c84ab329ba147f45a774c0fe8c33dcd41f969d6125bd36001f9bd747184cf7f73a261d3f6752f20a42376f2b26620c71f3d
         | 
| @@ -27,6 +27,13 @@ module EacRubyUtils | |
| 27 27 | 
             
                  push(value)
         | 
| 28 28 | 
             
                end
         | 
| 29 29 |  | 
| 30 | 
            +
                # @return [EacRubyUtils::BitArray] +self+.
         | 
| 31 | 
            +
                def push_array(other_bit_array)
         | 
| 32 | 
            +
                  values_array.push(*other_bit_array.to_a)
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                  self
         | 
| 35 | 
            +
                end
         | 
| 36 | 
            +
             | 
| 30 37 | 
             
                # @param value [EacRubyUtils::Bit]
         | 
| 31 38 | 
             
                # @return [EacRubyUtils::Bit]
         | 
| 32 39 | 
             
                def push(value)
         | 
    
        data/lib/eac_ruby_utils/byte.rb
    CHANGED
    
    | @@ -6,6 +6,7 @@ require 'eac_ruby_utils/patches/module/compare_by' | |
| 6 6 |  | 
| 7 7 | 
             
            module EacRubyUtils
         | 
| 8 8 | 
             
              class Byte
         | 
| 9 | 
            +
                ASSEMBLY_HEXADECIMAL_PREFIX = '$'
         | 
| 9 10 | 
             
                BIT_COUNT = 8
         | 
| 10 11 | 
             
                BIT_INDEX_RANGE = (0..7).freeze
         | 
| 11 12 | 
             
                VALUE_RANGE = (0..255).freeze
         | 
| @@ -77,8 +78,9 @@ module EacRubyUtils | |
| 77 78 | 
             
                  self.class.new(bit.zero? ? value & ~mask : value | mask)
         | 
| 78 79 | 
             
                end
         | 
| 79 80 |  | 
| 80 | 
            -
                 | 
| 81 | 
            -
             | 
| 81 | 
            +
                # @return [EacRubyUtils::BitArray]
         | 
| 82 | 
            +
                def to_bit_array(range = BIT_INDEX_RANGE)
         | 
| 83 | 
            +
                  ::EacRubyUtils::BitArray.new(range.map { |bit_index| self[bit_index] })
         | 
| 82 84 | 
             
                end
         | 
| 83 85 |  | 
| 84 86 | 
             
                # @return [Integer]
         | 
| @@ -86,6 +88,16 @@ module EacRubyUtils | |
| 86 88 | 
             
                  value
         | 
| 87 89 | 
             
                end
         | 
| 88 90 |  | 
| 91 | 
            +
                # @return [String]
         | 
| 92 | 
            +
                def to_asm_hex
         | 
| 93 | 
            +
                  ASSEMBLY_HEXADECIMAL_PREFIX + to_hex
         | 
| 94 | 
            +
                end
         | 
| 95 | 
            +
             | 
| 96 | 
            +
                # @return [String]
         | 
| 97 | 
            +
                def to_hex
         | 
| 98 | 
            +
                  value.to_s(16).upcase.rjust(2, '0')
         | 
| 99 | 
            +
                end
         | 
| 100 | 
            +
             | 
| 89 101 | 
             
                private
         | 
| 90 102 |  | 
| 91 103 | 
             
                attr_writer :value
         | 
| @@ -5,7 +5,7 @@ require 'eac_ruby_utils/patches/module/compare_by' | |
| 5 5 |  | 
| 6 6 | 
             
            module EacRubyUtils
         | 
| 7 7 | 
             
              class ByteArray
         | 
| 8 | 
            -
                delegate :to_a, :size, :count, :length, :[], :fetch, to: :values_array
         | 
| 8 | 
            +
                delegate :to_a, :size, :count, :length, :[], :fetch, :map, to: :values_array
         | 
| 9 9 | 
             
                compare_by :values_array
         | 
| 10 10 |  | 
| 11 11 | 
             
                def initialize(values = [])
         | 
| @@ -5,15 +5,23 @@ require 'open3' | |
| 5 5 | 
             
            module EacRubyUtils
         | 
| 6 6 | 
             
              module Envs
         | 
| 7 7 | 
             
                class Process
         | 
| 8 | 
            +
                  EXIT_CODE_KEY = :exit_code
         | 
| 9 | 
            +
                  ERR_KEY = :stderr
         | 
| 10 | 
            +
                  OUT_KEY = :stdout
         | 
| 11 | 
            +
             | 
| 8 12 | 
             
                  def initialize(command)
         | 
| 9 | 
            -
                     | 
| 10 | 
            -
                     | 
| 11 | 
            -
                     | 
| 13 | 
            +
                    self.data = { command: command }
         | 
| 14 | 
            +
                    data[OUT_KEY], data[ERR_KEY], data[EXIT_CODE_KEY] = Open3.capture3(command)
         | 
| 15 | 
            +
                    data[EXIT_CODE_KEY] = data[EXIT_CODE_KEY].to_i
         | 
| 12 16 | 
             
                  end
         | 
| 13 17 |  | 
| 14 18 | 
             
                  def to_h
         | 
| 15 | 
            -
                     | 
| 19 | 
            +
                    data.dup
         | 
| 16 20 | 
             
                  end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  private
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                  attr_accessor :data
         | 
| 17 25 | 
             
                end
         | 
| 18 26 | 
             
              end
         | 
| 19 27 | 
             
            end
         | 
| @@ -11,4 +11,15 @@ class Object | |
| 11 11 | 
             
                      "Argument \"#{argument_name}\" is not a #{klass}" \
         | 
| 12 12 | 
             
                      "(Actual class: #{self.class}, actual value: #{self})"
         | 
| 13 13 | 
             
              end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              # Raises a ArgumentError if +self.count+ is not equal to +count+.
         | 
| 16 | 
            +
              #
         | 
| 17 | 
            +
              # @return +self+
         | 
| 18 | 
            +
              def assert_count(count, argument_name = 'unknown_argument_name')
         | 
| 19 | 
            +
                return self if self.count == count
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                raise ::ArgumentError,
         | 
| 22 | 
            +
                      "Argument \"#{argument_name}\" has wrong elements count" \
         | 
| 23 | 
            +
                      "(Actual: #{self.count}, Required: #{count})"
         | 
| 24 | 
            +
              end
         | 
| 14 25 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: eac_ruby_utils
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.92.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Esquilo Azul Company
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2022- | 
| 11 | 
            +
            date: 2022-04-04 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activesupport
         |