Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ mkmf.log

# OS generated files #
.DS_Store

# Example output and data files
example/*.edf
example/*.zip
example/*.json.gz
58 changes: 35 additions & 23 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,68 @@
AllCops:
TargetRubyVersion: 2.6
DisplayCopNames: true
# Style/Documentation:
# Enabled: false
NewCops: enable

# Documentation is present at the module level
Style/Documentation:
Enabled: false

# These metrics are too strict for this codebase
Metrics/ClassLength:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/LineLength:
Max: 120
Metrics/AbcSize:
Max: 40
Metrics/MethodLength:
Enabled: false
Metrics/CyclomaticComplexity:
Max: 10
Metrics/PerceivedComplexity:
Max: 10

# Allow longer lines for readability
Layout/LineLength:
Max: 160

# Class style preferences
Style/ClassAndModuleChildren:
Enabled: false
# Frozen String Literal Pragma will not be needed in Ruby 3+ as it will be the
# default, Added `frozen_string_literal: true` to use this new default

# String literal preferences
Style/FrozenStringLiteralComment:
EnforcedStyle: always
# Strings assigned to constants will no longer be considered mutable in Ruby 3+
# This can be removed after Ruby 3 is released.
Style/MutableConstant:
Enabled: false

# Check quotes usage according to lint rule below.
Style/StringLiterals:
Enabled: true
EnforcedStyle: double_quotes

Style/StringLiteralsInInterpolation:
Enabled: true
EnforcedStyle: double_quotes

# Allow perl backrefs.
# Allow more flexible code style
Style/PerlBackrefs:
Enabled: false

# Allow symbol arrays.
Style/SymbolArray:
Enabled: false

# Allow word arrays.
Style/WordArray:
Enabled: false

# Don't require brackets for white-space separated arrays.
Style/PercentLiteralDelimiters:
Enabled: false

# Don't require formatted string tokens.
Style/FormatStringToken:
Enabled: false

# Prefer consistent use of lambda literal syntax in single- and multi-line.
# Lambda style
Style/Lambda:
EnforcedStyle: literal

# Naming conventions
Naming/HeredocDelimiterNaming:
Enabled: false

# Bundler configuration
Bundler/GemFilename:
Enabled: false

# Gemspec configuration
Gemspec/RequiredRubyVersion:
Enabled: false
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-2.6.1
3.3.6
2 changes: 2 additions & 0 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

SimpleCov.start do
add_group "Libraries", "/lib/"

Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
## 0.7.0 (Unreleased)

### Enhancements
- **Code Quality**
- Added RuboCop for code style enforcement
- Improved method naming to follow Ruby conventions
- Enhanced test coverage to 89.76%
- Fixed various code style and maintainability issues
- **Writing Support**
- Added support for writing EDF+ files
- New files can be written as continuous (EDF+C) or discontinuous (EDF+D)
- Automatically adds required EDF+ headers and annotations signal
- Full support for writing all signal types and data records
- **Gem Changes**
- Update to Ruby 3.3.6

## 0.6.0 (March 1, 2019)

### Enhancements
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,27 @@ Edfize.edfs do |edf|
end
```

### Writing EDF Files

The Edfize gem now supports writing EDF+ files. You can create new EDF files or modify existing ones:

```ruby
# Load an existing EDF file
edf = Edfize::Edf.new("input.edf")

# Write it to a new file (as continuous EDF+)
edf.write("output.edf", is_continuous: true)

# Write it as discontinuous EDF+
edf.write("output.edf", is_continuous: false)
```

The write functionality automatically:
- Adds required EDF+ headers
- Ensures at least one EDF Annotations signal exists (required for EDF+)
- Properly formats all header fields
- Writes signal data in the correct binary format

### Example of how to Load and Analyze EDFs in a Ruby Script

The following Ruby file demonstrates how to make use of the Edfize gem to load
Expand Down
Loading