Class: Rips::Variables::Inmediate
- Defined in:
- lib/rips/variables/inmediate.rb
Instance Attribute Summary collapse
-
#syntax ⇒ Object
readonly
Returns the value of attribute syntax.
Attributes inherited from Variable
Instance Method Summary collapse
-
#initialize(size = 8) ⇒ Inmediate
constructor
@syntax: example syntax @range: bit’s range for variable.
-
#valid_syntax?(value) ⇒ Boolean
Check input variable syntax.
Methods inherited from Variable
Constructor Details
#initialize(size = 8) ⇒ Inmediate
@syntax: example syntax @range: bit’s range for variable
12 13 14 15 16 |
# File 'lib/rips/variables/inmediate.rb', line 12 def initialize(size = 8) super(size) @range = [-2**(@length-1), 2**(@length-1)-1] @syntax = "#{@range[0]}..#{@range[1]}" end |
Instance Attribute Details
#syntax ⇒ Object (readonly)
Returns the value of attribute syntax.
8 9 10 |
# File 'lib/rips/variables/inmediate.rb', line 8 def syntax @syntax end |
Instance Method Details
#valid_syntax?(value) ⇒ Boolean
Check input variable syntax
19 20 21 22 |
# File 'lib/rips/variables/inmediate.rb', line 19 def valid_syntax? (value) value.extend(Rips::Utils::StringVariableExtension) value.inmediate? && value.valid_range?(@range) end |