Class: ConfigOMat::Template

Inherits:
ConfigItem show all
Defined in:
lib/config_o_mat/shared/types.rb

Instance Attribute Summary collapse

Attributes inherited from ConfigItem

#errors

Instance Method Summary collapse

Methods inherited from ConfigItem

#==, #error, #errors?, #validate!

Constructor Details

#initialize(opts) ⇒ Template

Returns a new instance of Template.



147
148
149
150
# File 'lib/config_o_mat/shared/types.rb', line 147

def initialize(opts)
  @src = opts[:src]
  @dst = opts[:dst]
end

Instance Attribute Details

#dstObject (readonly)

Returns the value of attribute dst.



145
146
147
# File 'lib/config_o_mat/shared/types.rb', line 145

def dst
  @dst
end

#srcObject (readonly)

Returns the value of attribute src.



145
146
147
# File 'lib/config_o_mat/shared/types.rb', line 145

def src
  @src
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


161
162
163
164
165
# File 'lib/config_o_mat/shared/types.rb', line 161

def eql?(other)
  return false if !super(other)
  return false if other.src != src || other.dst != dst
  true
end

#hashObject



157
158
159
# File 'lib/config_o_mat/shared/types.rb', line 157

def hash
  src.hash ^ dst.hash
end

#validateObject



152
153
154
155
# File 'lib/config_o_mat/shared/types.rb', line 152

def validate
  error :src, PRESENCE_ERROR_MSG if @src.nil? || @src.empty?
  error :dst, PRESENCE_ERROR_MSG if @dst.nil? || @dst.empty?
end