Class: Changi::Reader::StringReader

Inherits:
Object
  • Object
show all
Defined in:
lib/changi/reader/string_reader.rb

Direct Known Subclasses

CategoryReader

Instance Method Summary collapse

Instance Method Details

#read(attribute, _) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/changi/reader/string_reader.rb', line 6

def read attribute, _
  cli.ask("#{attribute[:name]}: ").tap do |x|
    if attribute[:opts][:required] && [nil, ''].include?(x)
      abort "required #{attribute[:name]} attribute empty, abort"
    end
  end
end