Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
leonovk committed Feb 12, 2024
1 parent 945178a commit 858692f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

Framework that allows you to use model classes for mapping Yaml files.

### Installation
## Installation

```ruby
gem 'activeyaml'
```

And then execute:

```bundle install```
Expand All @@ -22,7 +23,8 @@ Require if necessary:
```ruby
require 'active_yaml'
```
### Usage with model

## Usage with model

You can create models that will take data from your Yaml files. Suppose you have the following Yaml file: `examples/example.yaml`. With the following content:

Expand All @@ -34,17 +36,19 @@ start:
users:
first: '1'
```
(This and all subsequent examples will use this yaml file)
Then, you could do the following:
```ruby
require 'active_yaml'
require 'activeyaml'

class User < ActiveYaml::BaseModel
yaml 'examples/example.yaml'
end
```

You can then create instances of your model and use call chains to retrieve data from the Yaml file.

```ruby
Expand Down Expand Up @@ -92,11 +96,12 @@ end
```

After this, you can use class methods to make chains of calls.

```ruby
User.start.kek.lol # output: 'text'
```
With this use case, method `yaml_data` is also supported.

With this use case, method `yaml_data` is also supported.

You also don't have to create models to use this framework. After that, an object will be instantiated in the user variable, allowing chains of calls to be made. To do this you can do the following:

Expand All @@ -105,6 +110,6 @@ user = ActiveYaml.create('examples/example.yaml')
user.start.kek.lol # output: 'text'
```

### Contribution
## Contribution

If you would like to contribute to the development, submit a pull request with your changes. We welcome any contributions that improve the service. You can also view the current project board here. You can also contribute by reporting bugs or suggesting new features. Please use the GitHub issues for that.
3 changes: 3 additions & 0 deletions lib/activeyaml.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# frozen_string_literal: true

require_relative 'active_yaml'

0 comments on commit 858692f

Please sign in to comment.