Class: Dopstick::Generator::Gem::Options

Inherits:
Options
  • Object
show all
Defined in:
lib/dopstick/generator/gem/options.rb

Instance Method Summary collapse

Methods inherited from Options

#[], #github_url, #github_user, #initialize, #merge, #method_missing, #paypal_user, #respond_to_missing?, #skip_install?, #user_email, #user_name

Constructor Details

This class inherits a constructor from Dopstick::Generator::Options

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Dopstick::Generator::Options

Instance Method Details

#active_record?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/dopstick/generator/gem/options.rb', line 11

def active_record?
  @options[:active_record]
end

#bin?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/dopstick/generator/gem/options.rb', line 7

def bin?
  !@options[:bin].empty?
end

#namespace_namesObject



15
16
17
# File 'lib/dopstick/generator/gem/options.rb', line 15

def namespace_names
  @namespace_names ||= @options[:namespace].split("::")
end

#namespace_sizeObject



19
20
21
# File 'lib/dopstick/generator/gem/options.rb', line 19

def namespace_size
  @namespace_size ||= namespace_names.size
end

#oldest_ruby_versionObject



23
24
25
26
27
28
29
30
# File 'lib/dopstick/generator/gem/options.rb', line 23

def oldest_ruby_version
  version = ruby_versions
            .map {|v| ::Gem::Version.new(v) }
            .min
            .canonical_segments

  [*version, 0].take(3).join(".")
end