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.



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

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



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

def to_s
  @string
end