Sha256: 53c2741f92b3d6a8126dc1da67a5f36de965d51b44a3e85ca4a71cc260441ed3

Contents?: true

Size: 483 Bytes

Versions: 25

Compression:

Stored size: 483 Bytes

Contents

# frozen_string_literal: true

module Headdesk
  class Apk
    #
    # A Smali bytecode field
    #
    class Field
      attr_reader :code, :value

      def initialize(matchdata)
        @code = matchdata[0]
        @value = matchdata[1]

        @value.extend(ExtraMethods)
      end
    end

    #
    # Extra methods for 'value'
    #
    module ExtraMethods
      def to_version
        /^(\d+\.)?(\d+\.)?(\*|\d+)$/.match(self).captures.map(&:to_i)
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
headdesk-0.5.0 lib/headdesk/apk/field.rb
headdesk-0.4.0 lib/headdesk/apk/field.rb
headdesk-0.3.0 lib/headdesk/apk/field.rb
headdesk-0.2.0 lib/headdesk/apk/field.rb
headdesk-0.1.0 lib/headdesk/apk/field.rb