Sha256: f03693756b343df9f55c0d391c3328d1efffc686c0e1c4e883603a2683e39845

Contents?: true

Size: 737 Bytes

Versions: 8

Compression:

Stored size: 737 Bytes

Contents

# shamelessly stolen from https://github.com/sferik/rails_admin/blob/master/lib/generators/rails_admin/utils.rb

module Hancock::Cms
  module Generators
    module Utils
      module InstanceMethods
        def display(output, color = :green)
          say("           -  #{output}", color)
        end

        def ask_for(wording, default_value = nil, override_if_present_value = nil)
          if override_if_present_value.present?
            display("Using [#{override_if_present_value}] for question '#{wording}'") && override_if_present_value
          else
            ask("           ?  #{wording} Press <enter> for [#{default_value}] >", :yellow).presence || default_value
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hancock_cms-1.0.1 lib/generators/hancock/cms/utils.rb
hancock_cms-2.0.0.2 lib/generators/hancock/cms/utils.rb
hancock_cms-1.0.0.4 lib/generators/hancock/cms/utils.rb
hancock_cms-1.0.0.3 lib/generators/hancock/cms/utils.rb
hancock_cms-2.0.0.1 lib/generators/hancock/cms/utils.rb
hancock_cms-1.0.0.2 lib/generators/hancock/cms/utils.rb
hancock_cms-2.0.0 lib/generators/hancock/cms/utils.rb
hancock_cms-1.0.0 lib/generators/hancock/cms/utils.rb