Sha256: bece549a69ce2dcae8e915bc81167189c2220dc710e35082474e434a14b76c4c

Contents?: true

Size: 549 Bytes

Versions: 1

Compression:

Stored size: 549 Bytes

Contents

module FFI
  module Generator
    class Constant < Node
      def initialize(params = { })
        super
        @name, @value = get_attr('sym_name'), get_attr('value')
      end
      def to_s
        @indent_str + "#{@name} = #{sanitize!(@value)}"        
      end
      private
      def sanitize!(value)
        if @value.match(/\d+U$/) or @value.match(/\d+L$/)
          result = value.chop
        elsif @value.match(/\d+UL$/)
          result = @value.chop.chop
        else
          result = @value
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ffi-swig-generator-0.3.2 lib/generator/constant.rb