<commit_before>Properties
==========

In classes that mixin the ``Neo4j::ActiveNode`` or ``Neo4j::ActiveRel`` modules, properties must be declared using the ``property`` class method. It requires a single argument, a symbol that will correspond with the getter and setter as well as the property in the database.

.. code-block:: ruby

    class Post
      include Neo4j::ActiveNode

      property :title
    end

Two options are also available to both node and relationship models. They are:

- ``type``, to specify the expected class of the stored value in Ruby
- ``default``, a default value to set when the property is ``nil``

Node models have two more options:

- ``index: :exact`` to declare an exact index in the database
- ``constraint: :unique`` to declare a unique constraint

Note that a constraint is a type of index, so there is neither need nor ability to use both.

Finally, you can serialize properties as JSON with the `serialize` class method.

In practice, you can put it all together like this:

.. code-block:: ruby

  class Post
    include Neo4j::ActiveNode

    property :title, type: String, default: 'This ia new post', index: :exact
    property :links<commit_msg>Remove out of date properties info<commit_after>Properties
==========

In classes that mixin the ``Neo4j::ActiveNode`` or ``Neo4j::ActiveRel`` modules, properties must be declared using the ``property`` class method. It requires a single argument, a symbol that will correspond with the getter and setter as well as the property in the database.

.. code-block:: ruby

    class Post
      include Neo4j::ActiveNode

      property :title
    end

Two options are also available to both node and relationship models. They are:

- ``type``, to specify the expected class of the stored value in Ruby
- ``default``, a default value to set when the property is ``nil``

Finally, you can serialize properties as JSON with the `serialize` class method.

In practice, you can put it all together like this:

.. code-block:: ruby

  class Post
    include Neo4j::ActiveNode

    property :title, type: String, default: 'This ia new post'
    property :links
{'fraction_non_alphanumeric': 0.08403361344537816, 'fraction_numerical': 0.003734827264239029, 'mean_word_length': 3.9606481481481484, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '614343', 'n_tokens_mistral': 572, 'n_tokens_neox': 549, 'n_words': 300}