Class: Stitches::Configuration::NonNullString

Inherits:
Object
  • Object
show all
Defined in:
lib/stitches/configuration.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, string) ⇒ NonNullString

Returns a new instance of NonNullString.



98
99
100
101
102
103
104
105
106
# File 'lib/stitches/configuration.rb', line 98

def initialize(name,string)
  unless string.nil? || string.is_a?(String)
    raise "#{name} must be a String, not a #{string.class}"
  end
  if String(string).strip.length == 0
    raise "#{name} may not be blank"
  end
  @string = string
end

Instance Method Details

#to_sObject Also known as: to_str



108
109
110
# File 'lib/stitches/configuration.rb', line 108

def to_s
  @string
end