<commit_before># yuml

A Ruby DSL for generating UML built on yuml.me

## Getting Started

To build a UML document start with this block of code. Everything inside the block will be used to descibe the uml document you want to create.

```ruby
YUML.generate(file: 'tmp.pdf) do |uml|
  ...
end
```

### Generating a Class

To generate a class for the document use `uml.class` and pass a code block in to configure it. It accepts the following methods for configuration.

* name (required)
* variables
* methods

#### Example

```ruby
document = uml.class do
  name 'Document'
  variables '-title: String', '-body: String'
  methods(
    '+add_section(id: int, content: String, style: Symbol)',
    '+remove_section(id: int)',
    '+edit_section(id: int, content: String, style: Symbol)'
  )
end
```

### Adding Relationships

After generating some classes to add relationships to them use the following `YUML::Class` methods.

* `has_a(node, options = {})`
* `is_a(node, options = {})`

`has_a` defaults to aggregation and `is_a` defaults to inheritance.

#### Example

```ruby
document.has_a(picture, cardinality: '0..*')
document.is_a(content)

picture.is_a(content, type: :interface)
```

### Test it Out<commit_msg>Adding association docs to readme<commit_after># yuml

A Ruby DSL for generating UML built on yuml.me

## Getting Started

To build a UML document start with this block of code. Everything inside the block will be used to descibe the uml document you want to create.

```ruby
YUML.generate(file: 'tmp.pdf) do |uml|
  ...
end
```

### Generating a Class

To generate a class for the document use `uml.class` and pass a code block in to configure it. It accepts the following methods for configuration.

* name (required)
* variables
* methods

#### Example

```ruby
document = uml.class do
  name 'Document'
  variables '-title: String', '-body: String'
  methods(
    '+add_section(id: int, content: String, style: Symbol)',
    '+remove_section(id: int)',
    '+edit_section(id: int, content: String, style: Symbol)'
  )
end
```

### Adding Relationships

After generating some classes to add relationships to them use the following `YUML::Class` methods.

* `has_a(node, options = {})`
* `is_a(node, options = {})`
* `associated_with(node, options = {})`

`has_a` can be **composition** or **aggregation** but defaults to aggregation.

`is_a` can be **inheritance** or **interface** but defaults to inheritance.

`associated_with` can be **association** or **two_way_association** but defaults to association.

#### Example

```ruby
document.has_a(picture, cardinality: '0..*')
document.is_a(content)

picture.is_a(content, type: :interface)
```

### Test it Out
{'fraction_non_alphanumeric': 0.12938105891126025, 'fraction_numerical': 0.0007457121551081282, 'mean_word_length': 4.486707566462168, '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': '4680432', 'n_tokens_mistral': 871, 'n_tokens_neox': 832, 'n_words': 320}