# Class: EnfEditor::EEUserProperty

Inherits:
  EEAttribute
  - Object
  - EEBase
  - EEElement
  - EEAttribute
  - EnfEditor::EEUserProperty
  show all

Defined in:
  lib/enfeditor/core_ext/ee_user_property.rb,
  ext/enfhandler/EnfHandler_wrap2.cxx

## Overview

Proxy of C++ EnfEditor::EEUserProperty class

## Instance Method Summary collapse

- #delete! ⇒ Object

  Delete user property.

- #key ⇒ String

  Returns property key.

- #key=(new_key) ⇒ Object

  Rename Key.

- #subtype ⇒ String

  Returns property subtype.

- #subtype=(new_subtype) ⇒ Object

  Rename subtype.

- #type ⇒ Symbol

  Returns property type.

- #type=(new_type) ⇒ Object

  Change type.

- #value ⇒ String

  Returns property value.

- #value=(new_value) ⇒ Object

  Rename Value.

### Methods inherited from EEBase

#null?

## Instance Method Details

### #delete! ⇒ `Object`

Note:

After user property is deleted, do not access to user property class.

Delete user property

Examples:

    # Delete user property with key 'DB2'
    component.user_properties.each do |user_prop|
      if user_prop.key == 'DB2'
        user_prop.delete!
        p user_prop.null?     # => true.
      end
    end

Since:

- 0.1.0.0

### #key ⇒ `String`

Returns property key.

Examples:

    # Log property key
    component.user_properties.each do |user_prop|
      p user_prop.key # => 'AUTHOR'
    end

Returns:

- (`String`) —

  Returns property key.

Since:

- 0.1.0.0

### #key=(new_key) ⇒ `Object`

Rename Key

Examples:

    # Rename user property key from 'AUTHOR' to 'AUTHOR_ELYSIUM'
    component.user_properties.each do |user_prop|
      if user_prop.key == 'AUTHOR'
        user_prop.key = 'AUTHOR_ELYSIUM'
      end
    end

Parameters:

- new_key (`String`) —

  User attribute key to replace.

Since:

- 0.1.0.0

    20
    21
    22
    # File 'lib/enfeditor/core_ext/ee_user_property.rb', line 20

    def key=(new_key)
      self.set_key(new_key)
    end

### #subtype ⇒ `String`

Returns property subtype.

Examples:

    # Log property subtype
    component.user_properties.each do |user_prop|
      p user_prop.subtype # => 'CAD'
    end

Returns:

- (`String`) —

  Returns property subtype.

Since:

- 0.1.0.0

### #subtype=(new_subtype) ⇒ `Object`

Rename subtype

Examples:

    # Set user property subtype
    component.user_properties.each do |user_prop|
      if user_prop.key == 'AUTHOR'
        user_prop.subtype = 'japan'
      end
    end

Parameters:

- new_subtype (`String`) —

  User attribute subtype to replace.

Since:

- 0.1.0.0

    66
    67
    68
    # File 'lib/enfeditor/core_ext/ee_user_property.rb', line 66

    def subtype=(new_subtype)
      self.set_subtype(new_subtype)
    end

### #type ⇒ `Symbol`

Returns property type.

Examples:

    # Log property type
    component.user_properties.each do |user_prop|
      p user_prop.type # => :text
    end

Returns:

- (`Symbol`) —

  Returns property type.

Since:

- 0.1.0.0

### #type=(new_type) ⇒ `Object`

Note:

You should set proper value for each type. For example, you cannot set type = :integer if value == 'hoge' (not integer)

Change type

Examples:

    # Change integer property to text property
    component.user_properties.each do |user_prop|
      if user_prop.type == :integer
        user_prop.type = :text
      end
    end

Parameters:

- new_type (`Symbol`) —

  User attribute type to replace.

Since:

- 0.1.0.0

    51
    52
    53
    # File 'lib/enfeditor/core_ext/ee_user_property.rb', line 51

    def type=(new_type)
      self.set_type(new_type)
    end

### #value ⇒ `String`

Returns property value.

Examples:

    # Log property value
    component.user_properties.each do |user_prop|
      p user_prop.value # => 'john'
    end

Returns:

- (`String`) —

  Returns property value.

Since:

- 0.1.0.0

### #value=(new_value) ⇒ `Object`

Rename Value

Examples:

    # Set user property value
    component.user_properties.each do |user_prop|
      if user_prop.key == 'AUTHOR'
        user_prop.value = 'elena'
      end
    end

Parameters:

- new_value (`String`) —

  User attribute value to replace.

Since:

- 0.1.0.0

    35
    36
    37
    # File 'lib/enfeditor/core_ext/ee_user_property.rb', line 35

    def value=(new_value)
      self.set_value(new_value)
    end