Sha256: 08a823d3613f86add4b36b8e2897b9e0fabaafb128f742314c238fd5caf79167

Contents?: true

Size: 955 Bytes

Versions: 51

Compression:

Stored size: 955 Bytes

Contents

require 'fiona7/builder/obj_class_builder'

module Fiona7
  module Builder
    class ObjClassUpdater < ObjClassBuilder
      def validate
        existing_obj_class 
      end
      protected
      def existing_obj_class
        ret = RailsConnector::ObjClass.exists?(obj_class_name: @values[:name])
        @error_msg = "Expected #{@values[:name]} to exist" unless ret
        ret
      end

      def persist_obj_class
        @raw_obj_class = Reactor::Cm::ObjClass.get(@values[:name].to_s)
        user_attributes = @attributes.map {|a| a[:real_name] }
        user_attributes ||= []

        existing_attributes = @raw_obj_class.attributes
        built_in_attributes = Fiona7::Initializer::ATTRIBUTES_MAP.keys

        # NOTE: removing attributes is now impossible
        new_attributes = (existing_attributes + built_in_attributes + user_attributes).map(&:to_s).uniq

        @raw_obj_class.attributes = new_attributes
      end

    end
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
infopark_fiona7-1.6.1.1.5 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.6.1.1.1 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.6.1.1.0 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.2.0.2.3 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.2.0.2.1 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.2.0.2.2 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.5.5.5.1 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.5.5.5.0 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.2.0.1.4 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.5.5.4.1 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.5.5.4.0 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.2.0.1.3 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.5.5.3.1 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.5.4.3.0 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.5.3.2.0 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.5.3.2.0.pre.beta1 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.5.2.1.0.pre.beta1 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.5.2.0.0 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.2.0.1.1 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.2.0.0.1 lib/fiona7/builder/obj_class_updater.rb