Class: Rubex::DataType::Char

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/rubex/data_type/char.rb

Instance Method Summary collapse

Methods included from Helpers

#==, #base_type, #c_function_ptr?, #char_ptr?

Instance Method Details

#<=>(other) ⇒ Object



25
26
27
# File 'lib/rubex/data_type/char.rb', line 25

def <=>(other)
  other.char? ? 0 : 1
end

#char?Boolean

Returns:



21
22
23
# File 'lib/rubex/data_type/char.rb', line 21

def char?
  true
end

#from_ruby_object(arg) ⇒ Object



13
14
15
# File 'lib/rubex/data_type/char.rb', line 13

def from_ruby_object(arg)
  "(char)NUM2INT(#{arg})"
end

#p_formatterObject



17
18
19
# File 'lib/rubex/data_type/char.rb', line 17

def p_formatter
  '%c'
end

#to_ruby_object(arg, _literal = false) ⇒ Object



9
10
11
# File 'lib/rubex/data_type/char.rb', line 9

def to_ruby_object(arg, _literal = false)
  "#{Rubex::C_FUNC_CHAR2RUBYSTR}(#{arg})"
end

#to_sObject



5
6
7
# File 'lib/rubex/data_type/char.rb', line 5

def to_s
  'char'
end