lib/ember_serialize.rb in ember_serialize-0.0.1 vs lib/ember_serialize.rb in ember_serialize-0.0.2
- old
+ new
@@ -2,17 +2,17 @@
class Serializer
class << self
attr_accessor :javascripts_dir, :models_dir
end
- attr_accessor :args, :est, :een, :eig, :eai, :eas, :missing, :force_async, :javascripts_dir, :models_dir, :extension
+ attr_accessor :args, :est, :een, :eig, :eai, :eas, :missing, :javascripts_dir, :models_dir, :extension
def initialize(args)
@args = args
# args
@missing = args.extras.include?(':create') ? :create : :skip
- @force_async = args.extras.grep(/^async\:/) {|e| e =~ /true/}.first ? true : false
+ @force_async = args.extras.grep(/^async\:/) {|e| e =~ /true/}.first
# variables
@est = "ember_serialize:start"
@een = "ember_serialize:end"
@eig = "ember_serialize:ignore"
@eai = "ember_serialize:as_is"
@@ -39,10 +39,10 @@
Rails.application.eager_load!
# loop through serializers
ActiveModel::Serializer.descendants.sort_by(&:name).each do |serializer|
if match
- next unless serializer.name =~ /#{match}/
+ next unless serializer.name =~ /^#{match}/
end
schema = schema serializer
model = model_class serializer
ember_model_file = @models_dir + model.table_name.singularize + @extension
new_content = ember_model_build(schema, model, ember_model_parse(ember_model_file, model))