Module: Chef::Sugar::Ruby

Extended by:
Ruby
Included in:
Ruby
Defined in:
lib/chef/sugar/ruby.rb

Instance Method Summary collapse

Instance Method Details

#ruby_19?(node) ⇒ Boolean

Determine if the current Ruby version is 1.9.

Returns:

  • (Boolean)


37
38
39
40
# File 'lib/chef/sugar/ruby.rb', line 37

def ruby_19?(node)
  version = Gem::Version.new(node['languages']['ruby']['version'])
  Gem::Requirement.new('~> 1.9.0').satisfied_by?(version)
end

#ruby_20?(node) ⇒ Boolean

Determine if the current Ruby version is 2.0.

Returns:

  • (Boolean)


27
28
29
30
# File 'lib/chef/sugar/ruby.rb', line 27

def ruby_20?(node)
  version = Gem::Version.new(node['languages']['ruby']['version'])
  Gem::Requirement.new('~> 2.0.0').satisfied_by?(version)
end