<%- if model_config[:extension].present? -%> require_relative '<%= model_config[:extension][:file] %>' <%- end -%> module Tiss::Model class <%= model_name %> < <%= model_config[:extension].present? ? model_config[:extension][:class] : 'Base' %> <%- attributes.each_key do |key| %> # @type: <%= attributes[key].first[:type] %> attr_accessor :<%= key.gsub('-', '_') %> <% end -%> <%- attributes.each_key do |key| -%> <%- attr_versions = attributes[key].map{|attr| attr[:version]} -%> <%- versions = Tiss.config.available_versions - attr_versions -%> <%- if versions.any? && versions.count > 4 -%> attribute_config :<%= key.gsub('-', '_') %>, only: %w[<%= attr_versions.join(' ') %>] <%- elsif versions.any? && versions.count <= 4 -%> attribute_config :<%= key.gsub('-', '_') %>, unless: %w[<%= versions.join(' ') %>] <%- end %> <%- end -%> end end