class Cda::MetaInfo::Field

Public Instance Methods

allowed?() click to toggle source
# File lib/cda/meta_info.rb, line 55
def allowed?
  !prohibited?
end
build_method() click to toggle source
# File lib/cda/meta_info.rb, line 77
def build_method
  annotations[:build_method]
end
collection?() click to toggle source
# File lib/cda/meta_info.rb, line 67
def collection?
  type.respond_to?(:member_type)
end
complex?() click to toggle source
# File lib/cda/meta_info.rb, line 51
def complex?
  model_class.respond_to?(:attribute_set)
end
element_name() click to toggle source
# File lib/cda/meta_info.rb, line 71
def element_name
  @element_name ||= begin
    sanitize_element_name(model_class.respond_to?(:template_type) ? model_class.template_type : name)
  end
end
fully_qualified_name() click to toggle source
# File lib/cda/meta_info.rb, line 33
def fully_qualified_name
  sanitized_name = sanitize_element_name(name)
  ns = annotations[:ns]
  !ns.nil? ? "#{ns}:#{sanitized_name}" : sanitized_name
end
get_value(instance) click to toggle source
# File lib/cda/meta_info.rb, line 39
def get_value(instance)
  instance.send(name)
end
kind() click to toggle source
# File lib/cda/meta_info.rb, line 63
def kind
  annotations.fetch(:kind, :element)
end
model_class() click to toggle source
# File lib/cda/meta_info.rb, line 47
def model_class
  respond_to?(:member_type) ? member_type.primitive : type.primitive
end
new_instance() click to toggle source
# File lib/cda/meta_info.rb, line 88
def new_instance
  type.primitive.new
end
prohibited?() click to toggle source
# File lib/cda/meta_info.rb, line 59
def prohibited?
  annotations[:use] == :prohibited
end
set_value(instance, value) click to toggle source
# File lib/cda/meta_info.rb, line 43
def set_value(instance, value)
  instance.send("#{name}=", value)
end
wrapper_element_name() click to toggle source
# File lib/cda/meta_info.rb, line 81
def wrapper_element_name
  @wrapper_element_name ||= begin
    name, _ = annotations[:wrap_with]
    sanitize_element_name(name)
  end
end

Private Instance Methods

sanitize_element_name(element_name) click to toggle source
# File lib/cda/meta_info.rb, line 94
def sanitize_element_name(element_name)
  element_name.to_s.camelize(:lower).presence
end