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.2.0.0.0 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.1.0.0.9 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.1.0.0.8 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.1.0.0.7 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.1.0.0.6 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.1.0.0.5 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.1.0.0.4 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.1.0.0.3 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.1.0.0.2 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.1.0.0.10 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.1.0.0.1 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-1.1.0.0.0 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-0.71.1.9 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-0.71.1.8 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-0.71.1.7 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-0.71.1.6 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-0.71.1.5 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-0.71.1.4 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-0.71.1.3 lib/fiona7/builder/obj_class_updater.rb
infopark_fiona7-0.71.1.2 lib/fiona7/builder/obj_class_updater.rb