Sha256: ed1cfc2e0bc2b472e1ff6c5a8079ac87c24fa197946c815fdd99efb3ee606a76
Contents?: true
Size: 1.65 KB
Versions: 1
Compression:
Stored size: 1.65 KB
Contents
require 'vedeu/models/group' module Vedeu module DSL # DSL for adding interfaces to a group. # class Group include Vedeu::DSL # Specify a new group of interfaces with a simple DSL. # # The example below resembles 'vim' (the popular terminal-based text # editor): # # @example # Vedeu.group 'title_screen' do # add 'welcome_interface' # # ... # # Vedeu.group 'main_screen' do # add 'editor_interface' # add 'status_interface' # add 'command_interface' # # ... # # @note # Creating a group with the same name as an existing group overwrites # the existing group. # # @param name [String] The name of this group. # @param block [Proc] # @raise [InvalidSyntax] The required block was not given. # @return [Vedeu::Group] def self.group(name, &block) fail InvalidSyntax, 'block not given' unless block_given? Vedeu::Group.build({ name: name }, &block).store end # Returns an instance of DSL::Group. # # @param model [Group] # @param client [Object] # @return [Vedeu::DSL::Group] def initialize(model, client = nil) @model = model @client = client end # Add the named interface to this group. # # @param interface_name [String] # @return [void] def add(interface_name) model.add(interface_name) end private # @return [Object] attr_reader :client # @return [Group] attr_reader :model end # Group end # DSL end # Vedeu
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.4.5 | lib/vedeu/dsl/group.rb |