Module: OKF
- Defined in:
- lib/okf.rb,
lib/okf/cli.rb,
lib/okf/path.rb,
lib/okf/skill.rb,
lib/okf/bundle.rb,
lib/okf/concept.rb,
lib/okf/version.rb,
lib/okf/cli/dirs.rb,
lib/okf/cli/lint.rb,
lib/okf/cli/tags.rb,
lib/okf/registry.rb,
lib/okf/cli/files.rb,
lib/okf/cli/graph.rb,
lib/okf/cli/index.rb,
lib/okf/cli/loose.rb,
lib/okf/cli/skill.rb,
lib/okf/cli/stats.rb,
lib/okf/cli/types.rb,
lib/okf/safe_read.rb,
lib/okf/cli/render.rb,
lib/okf/cli/search.rb,
lib/okf/cli/server.rb,
lib/okf/server/app.rb,
lib/okf/server/hub.rb,
lib/okf/cli/catalog.rb,
lib/okf/cli/command.rb,
lib/okf/bundle/graph.rb,
lib/okf/cli/registry.rb,
lib/okf/cli/validate.rb,
lib/okf/concept/file.rb,
lib/okf/render/graph.rb,
lib/okf/bundle/folder.rb,
lib/okf/bundle/linter.rb,
lib/okf/bundle/reader.rb,
lib/okf/bundle/search.rb,
lib/okf/bundle/writer.rb,
lib/okf/server/runner.rb,
lib/okf/cli/references.rb,
lib/okf/markdown/links.rb,
lib/okf/bundle/skeleton.rb,
lib/okf/bundle/validator.rb,
lib/okf/bundle/references.rb,
lib/okf/bundle/row_filter.rb,
lib/okf/bundle/search/scan.rb,
lib/okf/markdown/citations.rb,
lib/okf/bundle/search/index.rb,
lib/okf/bundle/linter/report.rb,
lib/okf/markdown/frontmatter.rb,
lib/okf/server/hub/not_found.rb,
lib/okf/bundle/validator/result.rb
Defined Under Namespace
Modules: Markdown, Path, Render, SafeRead, Server Classes: Bundle, CLI, Concept, Error, Registry, Skill
Constant Summary collapse
- SPEC_VERSION =
The OKF spec version this gem targets — one declaration behind the validate header and its help row, so the version a bundle is judged against cannot be stated two ways. The gem still reads v0.1 (§13.1); this is what it validates for. Known readable versions: Concept::KNOWN_SPEC_VERSIONS.
"0.2"- VERSION =
"2.0.0"
Class Method Summary collapse
-
.blank?(value) ⇒ Boolean
Blank in the frontmatter sense: nil, false, an empty/whitespace-only string, or an empty collection.
-
.dir_of(id) ⇒ Object
The directory a concept lives in, derived from its §2 id: the id is the path minus
.md, so putting the suffix back and taking the dirname is the definition rather than a parse of it. -
.iso8601(value) ⇒ Object
A temporal value as ISO 8601 — the one serialization rule for generated_at/stale_after, shared by the catalog row and /node/meta so the served and baked pages cannot drift over one concept's dates.
Class Method Details
.blank?(value) ⇒ Boolean
Blank in the frontmatter sense: nil, false, an empty/whitespace-only string, or an empty collection. Numbers and other scalars are never blank. The one domain-wide predicate behind "non-empty type" (§11 cond. 2) and the recommended-field warnings, kept here so the gem needs no ActiveSupport.
21 22 23 24 25 26 |
# File 'lib/okf.rb', line 21 def self.blank?(value) return true if value.nil? || value == false return value.strip.empty? if value.is_a?(String) value.respond_to?(:empty?) ? value.empty? : false end |
.dir_of(id) ⇒ Object
The directory a concept lives in, derived from its §2 id: the id is the
path minus .md, so putting the suffix back and taking the dirname is the
definition rather than a parse of it. One home for it because three views
answer with a dir — the catalog, the search rows, the linter's per-directory
checks — and a rule spelled three times is three things to keep in step.
45 46 47 |
# File 'lib/okf.rb', line 45 def self.dir_of(id) File.dirname("#{id}.md") end |
.iso8601(value) ⇒ Object
A temporal value as ISO 8601 — the one serialization rule for generated_at/stale_after, shared by the catalog row and /node/meta so the served and baked pages cannot drift over one concept's dates. YAML hands over a Date or a Time for an unquoted value (whose default to_s is not ISO); a String passes through; a degenerate value serializes as its string, never as raw structure.
34 35 36 37 38 |
# File 'lib/okf.rb', line 34 def self.iso8601(value) return nil if value.nil? value.respond_to?(:iso8601) ? value.iso8601 : value.to_s end |