Class: Blossom::Application::Configuration::Value
- Inherits:
-
Struct
- Object
- Struct
- Blossom::Application::Configuration::Value
- Defined in:
- lib/blossom.rb
Instance Method Summary collapse
Instance Method Details
#boolean ⇒ Object
221 222 223 224 225 226 227 |
# File 'lib/blossom.rb', line 221 def boolean if value == true or value == false value else fail "Must be \`yes' or \`no\': #{name}" end end |
#duration ⇒ Object
229 230 231 232 233 234 235 |
# File 'lib/blossom.rb', line 229 def duration if value =~ /^((?:\d+\.)?\d+) ([a-z]+?)s?$/ $1.to_f * time_unit($2.to_sym) else error "Bad duration: #{value}" end end |
#string ⇒ Object
213 214 215 |
# File 'lib/blossom.rb', line 213 def string value.to_s end |
#words ⇒ Object
217 218 219 |
# File 'lib/blossom.rb', line 217 def words value.gsub(/^\s+|\s$/, "").split(/\s+/) end |