hitsuji 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/hitsuji.rb +9 -8
- data/lib/transfer.rb +2 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 38c0f6feab71c738601bce1ff568e1b0890520dfd78885f3879268e572ad4a28
|
4
|
+
data.tar.gz: 6fb893b80f070b0f3ccf4613ac2d0d57986392a83c02f30b0114e1a60e0f749b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8c0cfd160acff4a02eb0128c596d592d305c3614cf0b949fa59a5b51165044a6cccc742e9bba8fba928ae477d7413aa340206ea33ba6794b7760da67c98517e
|
7
|
+
data.tar.gz: 3aa84897e872f6908b0e2806004b899fecb5833b4639b2d4e0e31ea11a0a0791951a117cde373bd4503e37f7184f96f3c7e192c32e89cb6c01f51255d1a27102
|
data/lib/hitsuji.rb
CHANGED
@@ -103,7 +103,8 @@ class Hitsuji
|
|
103
103
|
# Exports the current state of the system to a file. This process *does not*
|
104
104
|
# export unbound items, linkers or operations! Creating new items doesn't
|
105
105
|
# automatically bind them to the system, so therefore the exported file
|
106
|
-
# only contains objects bound with Hitsuji.bind.
|
106
|
+
# only contains objects bound with Hitsuji.bind. The Hitsuji file must end
|
107
|
+
# with ".hitsuji".
|
107
108
|
#
|
108
109
|
# ==== Attributes
|
109
110
|
#
|
@@ -115,13 +116,13 @@ class Hitsuji
|
|
115
116
|
# my_system = Hitsuji.new # a new system
|
116
117
|
# my_item = Hitsuji.item(:foo, 1) # a new item
|
117
118
|
# my_system.bind(my_item) # binds item
|
118
|
-
# my_system.export('newfile.
|
119
|
+
# my_system.export('newfile.hitsuji') # exports to 'newfile.txt'
|
119
120
|
def export(directory)
|
120
121
|
Transfer.export(directory, @struct)
|
121
122
|
end
|
122
123
|
|
123
124
|
# Imports a file into a system, *overwriting anything already bound to the
|
124
|
-
# system*.
|
125
|
+
# system*. The Hitsuji file must end with ".hitsuji".
|
125
126
|
#
|
126
127
|
# ==== Attributes
|
127
128
|
#
|
@@ -130,7 +131,7 @@ class Hitsuji
|
|
130
131
|
# ==== Example
|
131
132
|
#
|
132
133
|
# my_system = Hitsuji.new # a new system
|
133
|
-
# my_system.import('oldfile.
|
134
|
+
# my_system.import('oldfile.hitsuji') # imports 'oldfile.txt'
|
134
135
|
def import(directory)
|
135
136
|
@struct = Transfer.import(directory)
|
136
137
|
update @struct
|
@@ -146,7 +147,7 @@ class Hitsuji
|
|
146
147
|
# ==== Example
|
147
148
|
#
|
148
149
|
# my_system = Hitsuji.new # a new system
|
149
|
-
# my_system.import('oldfile.
|
150
|
+
# my_system.import('oldfile.hitsuji') # imports 'oldfile.txt'
|
150
151
|
# my_item = my_system.find(:foo) # finds an item
|
151
152
|
def find(query)
|
152
153
|
get(query, @struct, nil, false)
|
@@ -163,7 +164,7 @@ class Hitsuji
|
|
163
164
|
# ==== Example
|
164
165
|
#
|
165
166
|
# my_system = Hitsuji.new # a new system
|
166
|
-
# my_system.import('oldfile.
|
167
|
+
# my_system.import('oldfile.hitsuji') # imports 'oldfile.txt'
|
167
168
|
# my_item = my_system.edit(:foo, 'bar') # changes an item
|
168
169
|
def edit(query, value)
|
169
170
|
get(query, @struct, value, false)
|
@@ -179,14 +180,14 @@ class Hitsuji
|
|
179
180
|
# ==== Example
|
180
181
|
#
|
181
182
|
# my_system = Hitsuji.new # a new system
|
182
|
-
# my_system.import('oldfile.
|
183
|
+
# my_system.import('oldfile.hitsuji') # imports 'oldfile.txt'
|
183
184
|
# my_item = my_system.remove(:foo) # removes an item
|
184
185
|
def remove(query)
|
185
186
|
get(query, @struct, nil, true)
|
186
187
|
end
|
187
188
|
|
188
189
|
#--
|
189
|
-
# BEGINNING OF
|
190
|
+
# BEGINNING OF FUCKED UP FUNCTIONS
|
190
191
|
#++
|
191
192
|
|
192
193
|
# Updates state of system to monitor name usageand dependencies on operations.
|
data/lib/transfer.rb
CHANGED
@@ -3,6 +3,7 @@ require_relative 'subsystem.rb'
|
|
3
3
|
# @private
|
4
4
|
class Transfer
|
5
5
|
def self.export(directory, struct)
|
6
|
+
throw 'err' unless directory.end_with?('.hitsuji')
|
6
7
|
File.open(directory, 'w') do |file|
|
7
8
|
encoded = Marshal.dump(struct)
|
8
9
|
file.write([encoded].pack('u'))
|
@@ -10,6 +11,7 @@ class Transfer
|
|
10
11
|
end
|
11
12
|
|
12
13
|
def self.import(directory)
|
14
|
+
throw 'err' unless directory.end_with?('.hitsuji')
|
13
15
|
File.open(directory, 'r') do |file|
|
14
16
|
decoded = file.read.unpack('u')
|
15
17
|
return Marshal.load(decoded.first)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hitsuji
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Quail
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
Hitsuji is a library that lets you easily create, edit,
|
@@ -29,7 +29,7 @@ licenses:
|
|
29
29
|
metadata:
|
30
30
|
source_code_uri: https://github.com/realtable/hitsuji
|
31
31
|
bug_tracker_uri: https://github.com/realtable/hitsuji/issues
|
32
|
-
documentation_uri: https://www.rubydoc.info/gems/hitsuji/0.
|
32
|
+
documentation_uri: https://www.rubydoc.info/gems/hitsuji/0.2.0
|
33
33
|
post_install_message:
|
34
34
|
rdoc_options: []
|
35
35
|
require_paths:
|
@@ -46,7 +46,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
46
|
version: '0'
|
47
47
|
requirements: []
|
48
48
|
rubyforge_project:
|
49
|
-
rubygems_version: 2.
|
49
|
+
rubygems_version: 2.7.7
|
50
50
|
signing_key:
|
51
51
|
specification_version: 4
|
52
52
|
summary: A utility for creating custom management systems.
|