Class: ConfigOMat::Profile
- Inherits:
-
ConfigItem
- Object
- ConfigItem
- ConfigOMat::Profile
- Defined in:
- lib/config_o_mat/shared/types.rb
Instance Attribute Summary collapse
-
#application ⇒ Object
readonly
Returns the value of attribute application.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#profile ⇒ Object
readonly
Returns the value of attribute profile.
-
#s3_fallback ⇒ Object
readonly
Returns the value of attribute s3_fallback.
Attributes inherited from ConfigItem
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(opts) ⇒ Profile
constructor
A new instance of Profile.
- #validate ⇒ Object
Methods inherited from ConfigItem
#==, #error, #errors?, #validate!
Constructor Details
#initialize(opts) ⇒ Profile
Returns a new instance of Profile.
171 172 173 174 175 176 |
# File 'lib/config_o_mat/shared/types.rb', line 171 def initialize(opts) @application = opts[:application] @environment = opts[:environment] @profile = opts[:profile] @s3_fallback = opts[:s3_fallback] end |
Instance Attribute Details
#application ⇒ Object (readonly)
Returns the value of attribute application.
169 170 171 |
# File 'lib/config_o_mat/shared/types.rb', line 169 def application @application end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
169 170 171 |
# File 'lib/config_o_mat/shared/types.rb', line 169 def environment @environment end |
#profile ⇒ Object (readonly)
Returns the value of attribute profile.
169 170 171 |
# File 'lib/config_o_mat/shared/types.rb', line 169 def profile @profile end |
#s3_fallback ⇒ Object (readonly)
Returns the value of attribute s3_fallback.
169 170 171 |
# File 'lib/config_o_mat/shared/types.rb', line 169 def s3_fallback @s3_fallback end |
Instance Method Details
#eql?(other) ⇒ Boolean
195 196 197 198 199 200 201 202 203 204 |
# File 'lib/config_o_mat/shared/types.rb', line 195 def eql?(other) return false if !super(other) if other.application != application || other.environment != environment || other.profile != profile || other.s3_fallback != s3_fallback return false end true end |
#hash ⇒ Object
191 192 193 |
# File 'lib/config_o_mat/shared/types.rb', line 191 def hash application.hash ^ environment.hash ^ profile.hash ^ s3_fallback.hash end |
#validate ⇒ Object
178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/config_o_mat/shared/types.rb', line 178 def validate error :application, PRESENCE_ERROR_MSG if @application.nil? || @application.empty? error :environment, PRESENCE_ERROR_MSG if @environment.nil? || @environment.empty? error :profile, PRESENCE_ERROR_MSG if @profile.nil? || @profile.empty? if !@s3_fallback.nil? if @s3_fallback.kind_of?(String) error :s3_fallback, 'must be non-empty' if @s3_fallback.empty? else error :s3_fallback, 'must be a string' end end end |