Tons more documentation.

This commit is contained in:
Andy Meneely
2014-07-29 17:16:19 -04:00
parent f3b4ca50a2
commit e5a889a274
9 changed files with 61 additions and 35 deletions
+2
View File
@@ -12,6 +12,7 @@ module Squib
# @option opts file [String, Array] ('') file(s) to read in. If it's a single file, then it's use for every card in range. If the parameter is an Array of files, then each file is looked up for each card. See {file:API.md#Specifying+Files Specifying Files}
# @option opts x [Integer] (0) the x-coordinate to place
# @option opts y [Integer] (0) the y-coordinate to place
# @option opts layout [String, Symbol] (nil) entry in the layout to use as defaults for this command. See {file:API.md#label-Custom+Layouts Custom Layouts}
# @option opts alpha [Decimal] (1.0) the alpha-transparency percentage used to blend this image
# @return [nil] Returns nil
# @api public
@@ -34,6 +35,7 @@ module Squib
# @option opts y [Integer] (0) the y-coordinate to place
# @option opts width [Integer] (:native) the pixel width that the image should scale to. SVG scaling is done with vectors, so the scaling should be smooth. When set to `:native`, uses the DPI and units of the loaded SVG document.
# @option opts height [Integer] (:native) the pixel width that the image should scale to. SVG scaling is done with vectors, so the scaling should be smooth. When set to `:native`, uses the DPI and units of the loaded SVG document.
# @option opts layout [String, Symbol] (nil) entry in the layout to use as defaults for this command. See {file:API.md#label-Custom+Layouts Custom Layouts}
# @return [nil] Returns nil
# @api public
def svg(opts = {})
+1
View File
@@ -17,6 +17,7 @@ module Squib
# @option opts fill_color [String] ('#0000') the color with which to fill the rectangle
# @option opts stroke_color [String] (:black) the color with which to stroke the outside of the rectangle
# @option opts stroke_width [Decimal] (2.0) the width of the outside stroke
# @option opts layout [String, Symbol] (nil) entry in the layout to use as defaults for this command. See {file:API.md#label-Custom+Layouts Custom Layouts}
# @return [nil] intended to be void
# @api public
def rect(opts = {})
+1
View File
@@ -23,6 +23,7 @@ module Squib
# @option opts markup: [Boolean] (false) Enable markup parsing of `str` using the HTML-like Pango Markup syntax, defined [here](http://ruby-gnome2.sourceforge.jp/hiki.cgi?pango-markup) and [here](https://developer.gnome.org/pango/stable/PangoMarkupFormat.html).
# @option opts width [Integer, :native] (:native) the width of the box the string will be placed in. Stretches to the content by default.
# @option opts height [Integer, :native] the height of the box the string will be placed in. Stretches to the content by default.
# @option opts layout [String, Symbol] (nil) entry in the layout to use as defaults for this command. See {file:API.md#label-Custom+Layouts Custom Layouts}
# @option opts wrap [:none, :word, :char, :word_char, true, false] (:word_char) When height is set, determines the behavior of how the string wraps. The `:word_char` option will break at words, but then fall back to characters when the word cannot fit. #
# Options are `:none, :word, :char, :word_char`. Also: `true` is the same as `:word_char`, `false` is the same as `:none`. Default `:word_char`
# @option opts align [:left, right, :center] (:left) The alignment of the text
+17
View File
@@ -1,7 +1,24 @@
module Squib
# Squib's command-line options
module Commands
# Generate a new Squib project into a fresh directory.
#
# Provides conventions for using Git (you are using version control, right??).
# Also provides some basic layout and config files to start from, along with templates for instructions and other notes you don't want to forget.
#
#
# @example
# squib new foo-blasters
# cd foo-blasters
# ruby deck.rb
# git commit -am "Starting my cool new game using Squib!"
#
# @api public
class New
# :nodoc:
# @api private
def process(args)
raise ArgumentError.new('Please specify a path.') if args.empty?
+10 -9
View File
@@ -1,18 +1,19 @@
module Squib
#@api public
# Squib's defaults for when arguments are not specified in the command nor layouts.
#
# @api public
SYSTEM_DEFAULTS = {
:range => :all,
:color => :black,
:range => :all,
:color => :black,
:str => '',
:fill_color => '#0000',
:stroke_color => :black,
:stroke_width => 2.0,
:font => :use_set,
:font => :use_set,
:default_font => 'Arial 36',
:sheet => 0,
:x => 0,
:y => 0,
:sheet => 0,
:x => 0,
:y => 0,
:x1 => 100,
:y1 => 100,
:x2 => 150,
@@ -27,7 +28,7 @@ module Squib
:ellipsize => :end,
:width => :native,
:height => :native,
:alpha => 1.0,
:alpha => 1.0,
:format => :png,
:dir => "_output",
:prefix => "card_",
+10
View File
@@ -5,6 +5,7 @@ module Squib
# @api private
module InputHelpers
# :nodoc:
# @api private
def needs(opts, params)
opts = layoutify(opts) if params.include? :layout
@@ -25,6 +26,7 @@ module Squib
end
module_function :needs
# :nodoc:
# @api private
def layoutify(opts)
unless opts[:layout].nil?
@@ -41,6 +43,7 @@ module Squib
end
module_function :layoutify
# :nodoc:
# @api private
def formatify(opts)
opts[:format] = [opts[:format]].flatten
@@ -48,6 +51,7 @@ module Squib
end
module_function :formatify
# :nodoc:
# @api private
def rangeify (opts)
range = opts[:range]
@@ -62,6 +66,7 @@ module Squib
end
module_function :rangeify
# :nodoc:
# @api private
def fileify(opts, expand_singletons=false, allow_non_exist=false)
opts[:file] = [opts[:file]] * @cards.size if expand_singletons
@@ -75,6 +80,7 @@ module Squib
end
module_function :fileify
# :nodoc:
# @api private
def dirify(opts, allow_create=false)
return opts if Dir.exists?(opts[:dir])
@@ -88,6 +94,7 @@ module Squib
end
module_function :dirify
# :nodoc:
# @api private
def colorify(opts, nillable=false)
if nillable # for optional color arguments like text hints
@@ -99,6 +106,7 @@ module Squib
end
module_function :colorify
# :nodoc:
# @api private
def fontify (opts)
opts[:font] = @font if opts[:font]==:use_set
@@ -107,6 +115,7 @@ module Squib
end
module_function :fontify
# :nodoc:
# @api private
def radiusify(opts)
unless opts[:radius].nil?
@@ -117,6 +126,7 @@ module Squib
end
module_function :radiusify
# :nodoc:
# @api private
def svgidify(opts)
unless opts[:id].nil?
+3
View File
@@ -1,3 +1,6 @@
module Squib
# The next version to be released.
# Uses semantic versioning
VERSION = "0.0.2"
end