Remove package only if version is not equal to a specific number

Hi all,

Do anyone have a sample package resource to remove a package only if its version is not equal to a specific number or any similar thing?

I'm thinking to use this in a recipe:

package 'my_package' do
only_if { }
action :remove
end

how can I get the installed package version in if equation ?

Regards
Bachar

Greetings!)
As far as i remember you can specify version of package to remove using version parameter.

package 'my_package' do 
  version 'some.version'
  action :remove
end