Class: Sprig::Reap::Inputs::Environment
- Inherits:
-
Object
- Object
- Sprig::Reap::Inputs::Environment
- Defined in:
- lib/sprig/reap/inputs/environment.rb
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
Class Method Summary collapse
Instance Method Summary collapse
- #env ⇒ Object
-
#initialize(input = nil) ⇒ Environment
constructor
A new instance of Environment.
Constructor Details
#initialize(input = nil) ⇒ Environment
Returns a new instance of Environment.
13 14 15 |
# File 'lib/sprig/reap/inputs/environment.rb', line 13 def initialize(input = nil) @input = input || Rails.env end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
3 4 5 |
# File 'lib/sprig/reap/inputs/environment.rb', line 3 def input @input end |
Class Method Details
.default ⇒ Object
5 6 7 |
# File 'lib/sprig/reap/inputs/environment.rb', line 5 def self.default new().env end |
.parse(input) ⇒ Object
9 10 11 |
# File 'lib/sprig/reap/inputs/environment.rb', line 9 def self.parse(input) new(input).env end |
Instance Method Details
#env ⇒ Object
17 18 19 20 21 22 |
# File 'lib/sprig/reap/inputs/environment.rb', line 17 def env input.to_s.strip.downcase.tap do |target_env| folder = Rails.root.join('db', 'seeds', target_env) FileUtils.mkdir_p(folder) unless File.directory? folder end end |