Module Amalgalite::SQLite3::Constants::Helpers
In: lib/amalgalite/sqlite3/constants.rb

Methods

Public Instance methods

convert an integer value into the string representation of the associated constant. this is a helper method used by some of the other modules

[Source]

    # File lib/amalgalite/sqlite3/constants.rb, line 17
17:       def name_from_value( value )
18:         unless @const_map_from_value
19:           @const_map_from_value = {}
20:           constants.each do |const_name|
21:             c_int = const_get( const_name )
22:             @const_map_from_value[c_int] = const_name
23:           end
24:         end
25:         return @const_map_from_value[ value ]
26:       end

convert a string into the constant value. This is helper method used by some of the other modules

[Source]

    # File lib/amalgalite/sqlite3/constants.rb, line 32
32:       def value_from_name( name )
33:         unless @const_map_from_name
34:           @const_map_from_name = {}
35:           constants.each do |const_name|
36:             c_int = const_get( const_name )
37:             @const_map_from_name[ const_name ] = c_int
38:           end
39:         end
40:         return @const_map_from_name[ name.upcase ]
41:       end

[Validate]