Sha256: 547cdceeba135c0f72472877428a6a8e068191be8256eadbb9c82f3846010ff8

Contents?: true

Size: 844 Bytes

Versions: 9

Compression:

Stored size: 844 Bytes

Contents

#
# Copyright (c) 2014 Red Hat Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 3 (GPLv3). 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 GPLv3
# along with this software; if not, see http://www.gnu.org/licenses/gpl.txt
#

require 'scaptimony/asset'

module ForemanOpenscap
  module AssetExtensions
    extend ActiveSupport::Concern
    included do
      belongs_to :assetable, :polymorphic => true
      scope :hosts, where(:assetable_type => 'Host::Base')
    end

    def host
      fetch_asset('Host::Base')
    end

    def name
      assetable.name
    end

    private
    def fetch_asset(type)
      assetable if assetable_type == type
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
foreman_openscap-0.4.3 app/models/concerns/foreman_openscap/asset_extensions.rb
foreman_openscap-0.4.2 app/models/concerns/foreman_openscap/asset_extensions.rb
foreman_openscap-0.4.1 app/models/concerns/foreman_openscap/asset_extensions.rb
foreman_openscap-0.3.4 app/models/concerns/foreman_openscap/asset_extensions.rb
foreman_openscap-0.4.0 app/models/concerns/foreman_openscap/asset_extensions.rb
foreman_openscap-0.3.3 app/models/concerns/foreman_openscap/asset_extensions.rb
foreman_openscap-0.3.2 app/models/concerns/foreman_openscap/asset_extensions.rb
foreman_openscap-0.3.1 app/models/concerns/foreman_openscap/asset_extensions.rb
foreman_openscap-0.3.0 app/models/concerns/foreman_openscap/asset_extensions.rb