class GeoserverMigrations::LayerConfig

Attributes

options[RW]

attr_writer :sld, :layer_name, :feature_name, :style_name

Public Class Methods

new(layer_name, is_update_style=false) click to toggle source
# File lib/geoserver_migrations/layer_config.rb, line 9
def initialize(layer_name, is_update_style=false)
  @options = {
      layer_name: layer_name,
      is_update_style: is_update_style
  }

end

Public Instance Methods

method_missing(method,*args,&block) click to toggle source
Calls superclass method
# File lib/geoserver_migrations/layer_config.rb, line 32
def method_missing(method,*args,&block)
  # puts "LayerConfig method-missing: #{method.inspect}, #{args.inspect}"
  if [:sld, :layer_name, :feature_name, :style_name].include? method.to_sym
    if args.size > 0
      value = args.size == 1 ? args.first : args
      value = value.strip if value.is_a? String 
      @options[method.to_sym] = value
    else 
      @options[method.to_sym]
    end
  else
    super
  end
end
style_name(style_name=nil) click to toggle source
# File lib/geoserver_migrations/layer_config.rb, line 24
def style_name(style_name=nil)
  if style_name.nil?
    @options[:style_name] || @options[:layer_name]
  else
    @options[:style_name] = style_name
  end   
end
valid?() click to toggle source
# File lib/geoserver_migrations/layer_config.rb, line 19
def valid?
  # at least feature-name should be present?
  options[:feature_name].present? || (options[:is_update_style] && options[:sld].present?)
end