Sha256: 236e43cdb4a11fbde7bd26eb797571fb0059a9c39db7471707f7df79c94f6fc5

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

#
# Copyright (c) 2014 Red Hat Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
# along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
#

require 'openscap/text'

module OpenSCAP
  module Xccdf
    class Profile
      attr_reader :raw

      def initialize(p)
        case p
        when FFI::Pointer
          @raw = p
        else
          raise OpenSCAP::OpenSCAPError, "Cannot initialize #{self.class.name} with #{p}"
        end
      end

      def id
        OpenSCAP.xccdf_profile_get_id raw
      end

      def title(prefered_lang = nil)
        textlist = OpenSCAP::TextList.new(OpenSCAP.xccdf_profile_get_title(@raw))
        title = textlist.plaintext(prefered_lang)
        textlist.destroy
        title
      end
    end
  end

  attach_function :xccdf_profile_get_id, [:pointer], :string
  attach_function :xccdf_profile_get_title, [:pointer], :pointer
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
openscap-0.4.8 lib/openscap/xccdf/profile.rb
openscap-0.4.7 lib/openscap/xccdf/profile.rb