divygrid 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.hound.yml +473 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +21 -0
- data/LICENSE.txt +22 -0
- data/README.md +95 -0
- data/Rakefile +11 -0
- data/divygrid.gemspec +26 -0
- data/lib/divy/div_generator.rb +97 -0
- data/lib/divy/divygrid_error.rb +13 -0
- data/lib/divy/grid.rb +113 -0
- data/lib/divy/version.rb +3 -0
- data/lib/divy.rb +8 -0
- data/test/lib/divy/div_generator_test.rb +131 -0
- data/test/lib/divy/grid_test.rb +206 -0
- data/test/lib/divy/html_examples.yml +150 -0
- data/test/lib/divy/version_test.rb +9 -0
- data/test/test_helper.rb +5 -0
- metadata +26 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38e392b50f6af50e3dfd478f272d62d369b7e941
|
4
|
+
data.tar.gz: 4967a50bc05991739dc5dd6e5bbac7bb24371c1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 208bf7eb651b078cb1b28964ff442553c9e99eea24a9b83a4b211109b727a0986d3dc480776c5fa15eb7abb19d7a5c84d8bc4e539bd2ab203aaa5a08935785cc
|
7
|
+
data.tar.gz: 3cf4b571121bf9455a0145bc9df4348443165d736f9cf1ef446a5fdfac564525a09cdef51f19353082526b92adf2ac09a967ce1966c7abd2d60aaafd6893009f
|
data/.gitignore
ADDED
data/.hound.yml
ADDED
@@ -0,0 +1,473 @@
|
|
1
|
+
# Common configuration.
|
2
|
+
AllCops:
|
3
|
+
# Include gemspec and Rakefile
|
4
|
+
Include:
|
5
|
+
- '**/*.gemspec'
|
6
|
+
- '**/Rakefile'
|
7
|
+
- '**/*.rake'
|
8
|
+
- '**/Gemfile'
|
9
|
+
Exclude:
|
10
|
+
- 'vendor/**'
|
11
|
+
RunRailsCops: true
|
12
|
+
|
13
|
+
# Indent private/protected/public as deep as method definitions
|
14
|
+
AccessModifierIndentation:
|
15
|
+
EnforcedStyle: outdent
|
16
|
+
SupportedStyles:
|
17
|
+
- outdent
|
18
|
+
- indent
|
19
|
+
|
20
|
+
# Indentation of `when`.
|
21
|
+
CaseIndentation:
|
22
|
+
IndentWhenRelativeTo: end
|
23
|
+
SupportedStyles:
|
24
|
+
- case
|
25
|
+
- end
|
26
|
+
IndentOneStep: false
|
27
|
+
|
28
|
+
ClassLength:
|
29
|
+
CountComments: false # count full line comments?
|
30
|
+
Max: 200
|
31
|
+
|
32
|
+
# Align ends correctly.
|
33
|
+
EndAlignment:
|
34
|
+
# The value `keyword` means that `end` should be aligned with the matching
|
35
|
+
# keyword (if, while, etc.).
|
36
|
+
# The value `variable` means that in assignments, `end` should be aligned
|
37
|
+
# with the start of the variable on the left hand side of `=`. In all other
|
38
|
+
# situations, `end` should still be aligned with the keyword.
|
39
|
+
AlignWith: variable
|
40
|
+
SupportedStyles:
|
41
|
+
- keyword
|
42
|
+
- variable
|
43
|
+
|
44
|
+
# Built-in global variables are allowed by default.
|
45
|
+
GlobalVars:
|
46
|
+
AllowedVariables: ['$1', '$2', '$3', '$4', '$5', '$6']
|
47
|
+
|
48
|
+
LineLength:
|
49
|
+
Max: 120
|
50
|
+
|
51
|
+
MethodLength:
|
52
|
+
CountComments: false # count full line comments?
|
53
|
+
Max: 20
|
54
|
+
|
55
|
+
NumericLiterals:
|
56
|
+
MinDigits: 10
|
57
|
+
|
58
|
+
SignalException:
|
59
|
+
EnforcedStyle: only_raise
|
60
|
+
SupportedStyles:
|
61
|
+
- only_raise
|
62
|
+
- only_fail
|
63
|
+
- semantic
|
64
|
+
|
65
|
+
SpaceBeforeBlockBraces:
|
66
|
+
EnforcedStyle: no_space
|
67
|
+
SupportedStyles:
|
68
|
+
- space
|
69
|
+
- no_space
|
70
|
+
|
71
|
+
SpaceInsideBlockBraces:
|
72
|
+
EnforcedStyle: no_space
|
73
|
+
SupportedStyles:
|
74
|
+
- space
|
75
|
+
- no_space
|
76
|
+
# Valid values are: space, no_space
|
77
|
+
EnforcedStyleForEmptyBraces: no_space
|
78
|
+
# Space between { and |. Overrides EnforcedStyle if there is a conflict.
|
79
|
+
SpaceBeforeBlockParameters: false
|
80
|
+
|
81
|
+
SpaceInsideHashLiteralBraces:
|
82
|
+
EnforcedStyle: no_space
|
83
|
+
EnforcedStyleForEmptyBraces: no_space
|
84
|
+
SupportedStyles:
|
85
|
+
- space
|
86
|
+
- no_space
|
87
|
+
|
88
|
+
WordArray:
|
89
|
+
MinSize: 0
|
90
|
+
|
91
|
+
##########################################################################
|
92
|
+
####################### DEFAULTS FROM RUBOCOP ############################
|
93
|
+
##########################################################################
|
94
|
+
|
95
|
+
# Align the elements of a hash literal if they span more than one line.
|
96
|
+
AlignHash:
|
97
|
+
# Alignment of entries using hash rocket as separator. Valid values are:
|
98
|
+
#
|
99
|
+
# key - left alignment of keys
|
100
|
+
# 'a' => 2
|
101
|
+
# 'bb' => 3
|
102
|
+
# separator - alignment of hash rockets, keys are right aligned
|
103
|
+
# 'a' => 2
|
104
|
+
# 'bb' => 3
|
105
|
+
# table - left alignment of keys, hash rockets, and values
|
106
|
+
# 'a' => 2
|
107
|
+
# 'bb' => 3
|
108
|
+
EnforcedHashRocketStyle: key
|
109
|
+
# Alignment of entries using colon as separator. Valid values are:
|
110
|
+
#
|
111
|
+
# key - left alignment of keys
|
112
|
+
# a: 0
|
113
|
+
# bb: 1
|
114
|
+
# separator - alignment of colons, keys are right aligned
|
115
|
+
# a: 0
|
116
|
+
# bb: 1
|
117
|
+
# table - left alignment of keys and values
|
118
|
+
# a: 0
|
119
|
+
# bb: 1
|
120
|
+
EnforcedColonStyle: key
|
121
|
+
# Select whether hashes that are the last argument in a method call should be
|
122
|
+
# inspected? Valid values are:
|
123
|
+
#
|
124
|
+
# always_inspect - Inspect both implicit and explicit hashes.
|
125
|
+
# Registers and offence for:
|
126
|
+
# function(a: 1,
|
127
|
+
# b: 2)
|
128
|
+
# Registers an offence for:
|
129
|
+
# function({a: 1,
|
130
|
+
# b: 2})
|
131
|
+
# always_ignore - Ignore both implicit and explicit hashes.
|
132
|
+
# Accepts:
|
133
|
+
# function(a: 1,
|
134
|
+
# b: 2)
|
135
|
+
# Accepts:
|
136
|
+
# function({a: 1,
|
137
|
+
# b: 2})
|
138
|
+
# ignore_implicit - Ingore only implicit hashes.
|
139
|
+
# Accepts:
|
140
|
+
# function(a: 1,
|
141
|
+
# b: 2)
|
142
|
+
# Registers an offence for:
|
143
|
+
# function({a: 1,
|
144
|
+
# b: 2})
|
145
|
+
# ignore_explicit - Ingore only explicit hashes.
|
146
|
+
# Accepts:
|
147
|
+
# function({a: 1,
|
148
|
+
# b: 2})
|
149
|
+
# Registers an offence for:
|
150
|
+
# function(a: 1,
|
151
|
+
# b: 2)
|
152
|
+
EnforcedLastArgumentHashStyle: always_inspect
|
153
|
+
SupportedLastArgumentHashStyles:
|
154
|
+
- always_inspect
|
155
|
+
- always_ignore
|
156
|
+
- ignore_implicit
|
157
|
+
- ignore_explicit
|
158
|
+
|
159
|
+
AlignParameters:
|
160
|
+
# Alignment of parameters in multi-line method calls.
|
161
|
+
#
|
162
|
+
# The `with_first_parameter` style aligns the following lines along the same column
|
163
|
+
# as the first parameter.
|
164
|
+
#
|
165
|
+
# method_call(a,
|
166
|
+
# b)
|
167
|
+
#
|
168
|
+
# The `with_fixed_indentation` style alignes the following lines with one
|
169
|
+
# level of indenation relative to the start of the line with the method call.
|
170
|
+
#
|
171
|
+
# method_call(a,
|
172
|
+
# b)
|
173
|
+
EnforcedStyle: with_first_parameter
|
174
|
+
SupportedStyles:
|
175
|
+
- with_first_parameter
|
176
|
+
- with_fixed_indentation
|
177
|
+
|
178
|
+
# Allow safe assignment in conditions.
|
179
|
+
AssignmentInCondition:
|
180
|
+
AllowSafeAssignment: true
|
181
|
+
|
182
|
+
BlockNesting:
|
183
|
+
Max: 3
|
184
|
+
|
185
|
+
BracesAroundHashParameters:
|
186
|
+
EnforcedStyle: no_braces
|
187
|
+
SupportedStyles:
|
188
|
+
- braces
|
189
|
+
- no_braces
|
190
|
+
|
191
|
+
ClassAndModuleChildren:
|
192
|
+
# Checks the style of children definitions at classes and modules.
|
193
|
+
#
|
194
|
+
# Basically there are two different styles:
|
195
|
+
#
|
196
|
+
# `nested` - have each child on a separat line
|
197
|
+
# class Foo
|
198
|
+
# class Bar
|
199
|
+
# end
|
200
|
+
# end
|
201
|
+
#
|
202
|
+
# `compact` - combine definitions as much as possible
|
203
|
+
# class Foo::Bar
|
204
|
+
# end
|
205
|
+
#
|
206
|
+
# The compact style is only forced, for classes / modules with one child.
|
207
|
+
EnforcedStyle: nested
|
208
|
+
SupportedStyles:
|
209
|
+
- nested
|
210
|
+
- compact
|
211
|
+
|
212
|
+
# Align with the style guide.
|
213
|
+
CollectionMethods:
|
214
|
+
# Mapping from undesired method to desired_method
|
215
|
+
# e.g. to use `detect` over `find`:
|
216
|
+
#
|
217
|
+
# CollectionMethods:
|
218
|
+
# PreferredMethods:
|
219
|
+
# find: detect
|
220
|
+
PreferredMethods:
|
221
|
+
collect: 'map'
|
222
|
+
collect!: 'map!'
|
223
|
+
inject: 'reduce'
|
224
|
+
detect: 'find'
|
225
|
+
find_all: 'select'
|
226
|
+
|
227
|
+
# Checks formatting of special comments
|
228
|
+
CommentAnnotation:
|
229
|
+
Keywords:
|
230
|
+
- TODO
|
231
|
+
- FIXME
|
232
|
+
- OPTIMIZE
|
233
|
+
- HACK
|
234
|
+
- REVIEW
|
235
|
+
|
236
|
+
# Avoid complex methods.
|
237
|
+
CyclomaticComplexity:
|
238
|
+
Max: 6
|
239
|
+
|
240
|
+
# Multi-line method chaining should be done with leading dots.
|
241
|
+
DotPosition:
|
242
|
+
EnforcedStyle: leading
|
243
|
+
SupportedStyles:
|
244
|
+
- leading
|
245
|
+
- trailing
|
246
|
+
|
247
|
+
# Use empty lines between defs.
|
248
|
+
EmptyLineBetweenDefs:
|
249
|
+
# If true, this parameter means that single line method definitions don't
|
250
|
+
# need an empty line between them.
|
251
|
+
AllowAdjacentOneLineDefs: false
|
252
|
+
|
253
|
+
FileName:
|
254
|
+
Exclude:
|
255
|
+
- Rakefile
|
256
|
+
- Gemfile
|
257
|
+
- Capfile
|
258
|
+
|
259
|
+
# Checks use of for or each in multiline loops.
|
260
|
+
For:
|
261
|
+
EnforcedStyle: each
|
262
|
+
SupportedStyles:
|
263
|
+
- for
|
264
|
+
- each
|
265
|
+
|
266
|
+
# Enforce the method used for string formatting.
|
267
|
+
FormatString:
|
268
|
+
EnforcedStyle: format
|
269
|
+
SupportedStyles:
|
270
|
+
- format
|
271
|
+
- sprintf
|
272
|
+
- percent
|
273
|
+
|
274
|
+
HashSyntax:
|
275
|
+
EnforcedStyle: ruby19
|
276
|
+
SupportedStyles:
|
277
|
+
- ruby19
|
278
|
+
- hash_rockets
|
279
|
+
|
280
|
+
IfUnlessModifier:
|
281
|
+
MaxLineLength: 79
|
282
|
+
|
283
|
+
# Checks the indentation of the first key in a hash literal.
|
284
|
+
IndentHash:
|
285
|
+
# The value `special_inside_parentheses` means that hash literals with braces
|
286
|
+
# that have their opening brace on the same line as a surrounding opening
|
287
|
+
# round parenthesis, shall have their first key indented relative to the
|
288
|
+
# first position inside the parenthesis.
|
289
|
+
# The value `consistent` means that the indentation of the first key shall
|
290
|
+
# always be relative to the first position of the line where the opening
|
291
|
+
# brace is.
|
292
|
+
EnforcedStyle: special_inside_parentheses
|
293
|
+
SupportedStyles:
|
294
|
+
- special_inside_parentheses
|
295
|
+
- consistent
|
296
|
+
|
297
|
+
LambdaCall:
|
298
|
+
EnforcedStyle: call
|
299
|
+
SupportedStyles:
|
300
|
+
- call
|
301
|
+
- braces
|
302
|
+
|
303
|
+
MethodDefParentheses:
|
304
|
+
EnforcedStyle: require_parentheses
|
305
|
+
SupportedStyles:
|
306
|
+
- require_parentheses
|
307
|
+
- require_no_parentheses
|
308
|
+
|
309
|
+
MethodLength:
|
310
|
+
CountComments: false # count full line comments?
|
311
|
+
Max: 10
|
312
|
+
|
313
|
+
MethodName:
|
314
|
+
EnforcedStyle: snake_case
|
315
|
+
SupportedStyles:
|
316
|
+
- snake_case
|
317
|
+
- camelCase
|
318
|
+
|
319
|
+
ParameterLists:
|
320
|
+
Max: 5
|
321
|
+
CountKeywordArgs: true
|
322
|
+
|
323
|
+
# Allow safe assignment in conditions.
|
324
|
+
ParenthesesAroundCondition:
|
325
|
+
AllowSafeAssignment: true
|
326
|
+
|
327
|
+
PercentLiteralDelimiters:
|
328
|
+
PreferredDelimiters:
|
329
|
+
'%': ()
|
330
|
+
'%i': ()
|
331
|
+
'%q': ()
|
332
|
+
'%Q': ()
|
333
|
+
'%r': '{}'
|
334
|
+
'%s': ()
|
335
|
+
'%w': ()
|
336
|
+
'%W': ()
|
337
|
+
'%x': ()
|
338
|
+
|
339
|
+
PredicateName:
|
340
|
+
NamePrefixBlacklist:
|
341
|
+
- is_
|
342
|
+
- has_
|
343
|
+
- have_
|
344
|
+
|
345
|
+
RaiseArgs:
|
346
|
+
EnforcedStyle: exploded
|
347
|
+
SupportedStyles:
|
348
|
+
- compact # raise Exception.new(msg)
|
349
|
+
- exploded # raise Exception, msg
|
350
|
+
|
351
|
+
|
352
|
+
RedundantReturn:
|
353
|
+
# When true allows code like `return x, y`.
|
354
|
+
AllowMultipleReturnValues: false
|
355
|
+
|
356
|
+
RegexpLiteral:
|
357
|
+
# The maximum number of (escaped) slashes that a slash-delimited regexp is
|
358
|
+
# allowed to have. If there are more slashes, a %r regexp shall be used.
|
359
|
+
MaxSlashes: 1
|
360
|
+
|
361
|
+
Semicolon:
|
362
|
+
# Allow ; to separate several expressions on the same line.
|
363
|
+
AllowAsExpressionSeparator: false
|
364
|
+
|
365
|
+
SingleLineBlockParams:
|
366
|
+
Methods:
|
367
|
+
- reduce:
|
368
|
+
- a
|
369
|
+
- e
|
370
|
+
- inject:
|
371
|
+
- a
|
372
|
+
- e
|
373
|
+
|
374
|
+
SingleLineMethods:
|
375
|
+
AllowIfMethodIsEmpty: true
|
376
|
+
|
377
|
+
StringLiterals:
|
378
|
+
EnforcedStyle: single_quotes
|
379
|
+
SupportedStyles:
|
380
|
+
- single_quotes
|
381
|
+
- double_quotes
|
382
|
+
|
383
|
+
SpaceAroundEqualsInParameterDefault:
|
384
|
+
EnforcedStyle: space
|
385
|
+
SupportedStyles:
|
386
|
+
- space
|
387
|
+
- no_space
|
388
|
+
|
389
|
+
TrailingBlankLines:
|
390
|
+
EnforcedStyle: final_newline
|
391
|
+
SupportedStyles:
|
392
|
+
- final_newline
|
393
|
+
- final_blank_line
|
394
|
+
|
395
|
+
TrailingComma:
|
396
|
+
EnforcedStyleForMultiline: no_comma
|
397
|
+
SupportedStyles:
|
398
|
+
- comma
|
399
|
+
- no_comma
|
400
|
+
|
401
|
+
# TrivialAccessors doesn't require exact name matches and doesn't allow
|
402
|
+
# predicated methods by default.
|
403
|
+
TrivialAccessors:
|
404
|
+
ExactNameMatch: false
|
405
|
+
AllowPredicates: false
|
406
|
+
# Allows trivial writers that don't end in an equal sign. e.g.
|
407
|
+
#
|
408
|
+
# def on_exception(action)
|
409
|
+
# @on_exception=action
|
410
|
+
# end
|
411
|
+
# on_exception :restart
|
412
|
+
#
|
413
|
+
# Commonly used in DSLs
|
414
|
+
AllowDSLWriters: false
|
415
|
+
Whitelist:
|
416
|
+
- to_ary
|
417
|
+
- to_a
|
418
|
+
- to_c
|
419
|
+
- to_enum
|
420
|
+
- to_h
|
421
|
+
- to_hash
|
422
|
+
- to_i
|
423
|
+
- to_int
|
424
|
+
- to_io
|
425
|
+
- to_open
|
426
|
+
- to_path
|
427
|
+
- to_proc
|
428
|
+
- to_r
|
429
|
+
- to_regexp
|
430
|
+
- to_str
|
431
|
+
- to_s
|
432
|
+
- to_sym
|
433
|
+
|
434
|
+
VariableName:
|
435
|
+
EnforcedStyle: snake_case
|
436
|
+
SupportedStyles:
|
437
|
+
- snake_case
|
438
|
+
- camelCase
|
439
|
+
|
440
|
+
WhileUntilModifier:
|
441
|
+
MaxLineLength: 79
|
442
|
+
|
443
|
+
##################### Rails ##################################
|
444
|
+
|
445
|
+
ActionFilter:
|
446
|
+
EnforcedStyle: action
|
447
|
+
SupportedStyles:
|
448
|
+
- action
|
449
|
+
- filter
|
450
|
+
Include:
|
451
|
+
- app/controllers/*.rb
|
452
|
+
|
453
|
+
DefaultScope:
|
454
|
+
Include:
|
455
|
+
- app/models/*.rb
|
456
|
+
|
457
|
+
HasAndBelongsToMany:
|
458
|
+
Include:
|
459
|
+
- app/models/*.rb
|
460
|
+
|
461
|
+
ReadWriteAttribute:
|
462
|
+
Include:
|
463
|
+
- app/models/*.rb
|
464
|
+
|
465
|
+
ScopeArgs:
|
466
|
+
Include:
|
467
|
+
- app/models/*.rb
|
468
|
+
|
469
|
+
Validation:
|
470
|
+
Include:
|
471
|
+
- app/models/*.rb
|
472
|
+
|
473
|
+
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
divygrid (0.0.2)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
metaclass (0.0.4)
|
10
|
+
mocha (0.14.0)
|
11
|
+
metaclass (~> 0.0.1)
|
12
|
+
rake (0.9.6)
|
13
|
+
|
14
|
+
PLATFORMS
|
15
|
+
ruby
|
16
|
+
|
17
|
+
DEPENDENCIES
|
18
|
+
bundler (~> 1.3)
|
19
|
+
divygrid!
|
20
|
+
mocha (~> 0)
|
21
|
+
rake (~> 0)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Stephen Salinas
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
divygrid
|
2
|
+
=========
|
3
|
+
|
4
|
+
Creates a coordinate-graph style grid and can place images or other content based on x and y coordinates. Just specify the size of your grid, the content and its location.
|
5
|
+
|
6
|
+
Usage
|
7
|
+
------------
|
8
|
+
|
9
|
+
getting back an example grid 10 by 10, with solid black grid lines and no content blocks
|
10
|
+
```ruby
|
11
|
+
grid = Divy::Grid.new
|
12
|
+
grid.html
|
13
|
+
```
|
14
|
+
|
15
|
+
Setting content for a grid and generating
|
16
|
+
```ruby
|
17
|
+
options = {
|
18
|
+
content: [
|
19
|
+
{type: :html, value: 'coolhtmlstuff', location: [1, 3], size: [1, 1]},
|
20
|
+
{type: :image, value: 'someimagepath', location: [1, 3], size: [2, 2]}
|
21
|
+
],
|
22
|
+
grid_dimensions: [5, 5],
|
23
|
+
show_grid: true,
|
24
|
+
grid_color: '#FF00CC',
|
25
|
+
container_size: [100, 100]
|
26
|
+
}
|
27
|
+
grid = Divy::Grid.new(options)
|
28
|
+
grid.html
|
29
|
+
```
|
30
|
+
Options can also be set using
|
31
|
+
```ruby
|
32
|
+
grid = Divy::Grid.new
|
33
|
+
grid.content = [
|
34
|
+
{type: :html, value: 'coolhtmlstuff', location: [1, 3], size: [1, 1]},
|
35
|
+
{type: :image, value: 'someimagepath', location: [1, 3], size: [2, 2]}
|
36
|
+
]
|
37
|
+
grid.grid_dimensions = [5, 5]
|
38
|
+
grid.show_grid = true
|
39
|
+
grid.grid_color = '#FF00CC'
|
40
|
+
grid.container_size = [100, 100]
|
41
|
+
grid.html
|
42
|
+
```
|
43
|
+
note, html_safe is not called on the returned string
|
44
|
+
|
45
|
+
Available input options
|
46
|
+
------------
|
47
|
+
|
48
|
+
###show_grid
|
49
|
+
|
50
|
+
true or false => generate a div for each box in the grid, defaults to true if a grid color is chosen, defaults to false
|
51
|
+
|
52
|
+
###grid_color
|
53
|
+
|
54
|
+
Hex color as a string or 'invisible' => if not invisible the background coordinate plane graph will show as this color (border of divs), defaults to 'invisible'
|
55
|
+
|
56
|
+
###container_size
|
57
|
+
|
58
|
+
[width, height] specified in px => the height and width of the containing div element
|
59
|
+
- integers will result in sizes in px
|
60
|
+
- percentages as a string can also be used
|
61
|
+
- defaults to 100% x 100%
|
62
|
+
|
63
|
+
###grid_dimensions
|
64
|
+
|
65
|
+
[x, y] integers => number of 'cells' (ie. create a coordinate plane of x elements by y elements that fits in container_size)
|
66
|
+
|
67
|
+
###content
|
68
|
+
|
69
|
+
{
|
70
|
+
type: valid options are :html, :image, :none
|
71
|
+
value: html string for :html, image path for :image
|
72
|
+
location: [x, y] cooresponding to a point on the grid to center the content on
|
73
|
+
size: [x, y] number of grid units to fill (ie. 1 X 1 square on a 5x5 grid filled with given content)
|
74
|
+
}
|
75
|
+
|
76
|
+
When html content is passed, it is passed through as-is
|
77
|
+
|
78
|
+
Styles
|
79
|
+
------------
|
80
|
+
|
81
|
+
If you need to set styles of the div elements via css, the containing element is class='divycontainer', boxes and content boxes are class='divybox'
|
82
|
+
|
83
|
+
Contributing
|
84
|
+
------------
|
85
|
+
|
86
|
+
If you make improvements to this application, please share with others.
|
87
|
+
|
88
|
+
- Fork the project on GitHub.
|
89
|
+
- Make your feature addition or bug fix.
|
90
|
+
- Commit with Git.
|
91
|
+
- Send the author a pull request.
|
92
|
+
|
93
|
+
If you add functionality to this application, create an alternative
|
94
|
+
implementation, or build an application that is similar, please contact
|
95
|
+
me and I’ll add a note to the README so that others can find your work.
|
data/Rakefile
ADDED
data/divygrid.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'divy/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = 'divygrid'
|
8
|
+
s.version = Divy::VERSION
|
9
|
+
s.date = '2014-05-09'
|
10
|
+
s.summary = 'Coordinate-style grid layout for images and other content'
|
11
|
+
s.description = 'A Coordinate-style grid layout for images and other html content'
|
12
|
+
s.authors = ['Stephen Salinas']
|
13
|
+
s.email = 'shsalinas2012@gmail.com'
|
14
|
+
s.homepage = 'https://github.com/ssalinas/divy_grid'
|
15
|
+
s.license = 'MIT'
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
18
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
19
|
+
s.require_paths = ['lib']
|
20
|
+
|
21
|
+
s.add_development_dependency 'bundler', '~> 1.3'
|
22
|
+
s.add_development_dependency 'rake', '~> 0'
|
23
|
+
s.add_development_dependency 'mocha', '~> 0'
|
24
|
+
end
|
25
|
+
|
26
|
+
|