Sha256: 8bc47432ef0c6dc2fa7d91e8601d22c7bc5529f65251f8152958235d74bcbe2d

Contents?: true

Size: 578 Bytes

Versions: 2

Compression:

Stored size: 578 Bytes

Contents

require "rips/variables/variable"

module Rips
  module Variables

    class Inmediate < Variable 

      attr_reader :syntax

      # @syntax: example syntax
      # @range: bit's range for variable
      def initialize(size = 8)
        super(size)
        @range = [-2**(@length-1), 2**(@length-1)-1]
        @syntax = "#{@range[0]}..#{@range[1]}"
      end

      # Check input variable syntax
      def valid_syntax? (value)
        value.extend(Rips::Utils::StringVariableExtension)
        value.inmediate? && value.valid_range?(@range)
      end
      
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rips-0.1.1 lib/rips/variables/inmediate.rb
rips-0.1.0 lib/rips/variables/inmediate.rb