Object
# File lib/sax-machine/sax_element_config.rb, line 7 def initialize(name, options) @name = name.to_s if options.has_key?(:with) # for faster comparisons later @with = options[:with].to_a.flatten.collect {|o| o.to_s} else @with = nil end if options.has_key?(:value) @value = options[:value].to_s else @value = nil end @as = options[:as] @collection = options[:collection] if @collection @setter = "add_#{options[:as]}" else @setter = "#{@as}=" end @data_class = options[:class] @required = options[:required] end
# File lib/sax-machine/sax_element_config.rb, line 55 def attrs_match?(attrs) if @with @with == (@with & attrs) else true end end
# File lib/sax-machine/sax_element_config.rb, line 67 def collection? @collection end
# File lib/sax-machine/sax_element_config.rb, line 43 def column @as || @name.to_sym end
# File lib/sax-machine/sax_element_config.rb, line 63 def has_value_and_attrs_match?(attrs) !@value.nil? && attrs_match?(attrs) end
# File lib/sax-machine/sax_element_config.rb, line 47 def required? @required end
# File lib/sax-machine/sax_element_config.rb, line 39 def to_s "name: #{@name} dataclass: #{@data_class} setter: #{@setter} required: #{@required} value: #{@value} as:#{@as} collection: #{@collection} with: #{@with}" end
Generated with the Darkfish Rdoc Generator 2.