module ApipieDSL::Klass
Public Instance Methods
app_info(app_info)
click to toggle source
# File lib/apipie_dsl/dsl.rb, line 261 def app_info(app_info) dsl_data[:app_info] = app_info end
class_description(&block)
click to toggle source
# File lib/apipie_dsl/dsl.rb, line 265 def class_description(&block) dsl_data = apipie_eval_dsl(&block) dsl_data[:dsl_versions] = ApipieDSL.class_versions(class_scope) if dsl_data[:dsl_versions].empty? versions = dsl_data[:dsl_versions] versions.map do |version| ApipieDSL.define_class_description(class_scope, version, dsl_data) end ApipieDSL.set_class_versions(class_scope, versions) end
default_prop_group_scope()
click to toggle source
Where the group definition should be looked up when no scope given. This is expected to return a class.
# File lib/apipie_dsl/dsl.rb, line 347 def default_prop_group_scope class_scope end
define_prop_group(name, &block)
click to toggle source
# File lib/apipie_dsl/dsl.rb, line 317 def define_prop_group(name, &block) ApipieDSL.define_prop_group(class_scope, name, &block) end
name(new_name)
click to toggle source
# File lib/apipie_dsl/dsl.rb, line 275 def name(new_name) dsl_data[:class_name] = new_name end
Also aliased as: label
prop_group(name, scope_or_options = nil, options = {})
click to toggle source
Reuses param group for this method. The definition is looked up in scope of this class. If the group was defined in different class, the second param can be used to specify it.
# File lib/apipie_dsl/dsl.rb, line 324 def prop_group(name, scope_or_options = nil, options = {}) if scope_or_options.is_a?(Hash) options.merge!(scope_or_options) scope = options[:scope] else scope = scope_or_options end scope ||= default_prop_group_scope @current_prop_group = { scope: scope, name: name, options: options } @meta = (options[:meta] || {}).tap { |meta| meta[:class_scope] = class_scope } instance_exec(&ApipieDSL.get_prop_group(scope, name)) ensure @current_prop_group = nil @meta = nil end
property(name, retobj_or_options, desc_or_options = nil, options = {}, &block)
click to toggle source
# File lib/apipie_dsl/dsl.rb, line 300 def property(name, retobj_or_options, desc_or_options = nil, options = {}, &block) if desc_or_options.is_a?(Hash) options.merge!(desc_or_options) elsif !desc_or_options.nil? options[:desc] = desc_or_options end options[:property] = true returns = returns(retobj_or_options, desc_or_options, options, &block) prop_dsl_data = { short_description: options[:desc], returns: returns } dsl_data[:properties] << [name, prop_dsl_data] end
Also aliased as: prop
refs(*class_names)
click to toggle source
# File lib/apipie_dsl/dsl.rb, line 280 def refs(*class_names) dsl_data[:refs] = class_names end
Also aliased as: referenced_on
sections(sec_or_options, options = {})
click to toggle source
# File lib/apipie_dsl/dsl.rb, line 285 def sections(sec_or_options, options = {}) if sec_or_options.is_a?(Hash) options.merge!(sec_or_options) elsif !sec_or_options.nil? options[:only] = sec_or_options end only = [options[:only]].flatten || ApipieDSL.configuration.sections except = if options[:except] [options[:except]].flatten else [] end dsl_data[:sections] = only - except end